Hi,
I'm trying to run a SP with a select statement. Example below:
Stored procedure: uspI_InsertUsername (@.Username VARCHAR(50))
SQL Statement: EXEC uspR_InsertUsername SELECT Username FROM TempUser
Will this work?
--
Thanks,
Jig PatelYou can store the result of the query to a temporary variable and execute th
e
sp using the result
declare @.user VARCHAR(50)
select @.user = Username
FROM TempUser
EXEC uspR_InsertUsername @.user
it will work when
select Username
FROM TempUser
returns only one user, otherwise you will have to declare @.user as a table
variable and loop through it to execute the procedure for each row
Let me know if it helps
"Jig" wrote:
> Hi,
> I'm trying to run a SP with a select statement. Example below:
> Stored procedure: uspI_InsertUsername (@.Username VARCHAR(50))
> SQL Statement: EXEC uspR_InsertUsername SELECT Username FROM TempUser
> Will this work?
> --
> Thanks,
> Jig Patel|||Could you be more specific on what you want to reach.
Showing posts with label belowstored. Show all posts
Showing posts with label belowstored. Show all posts
Monday, March 19, 2012
Subscribe to:
Posts (Atom)