caglarkumanli
asked on
Exec
Hi all,
I want to run a select statement with EXEC keyword in my stored procedure.
For example EXEC ('SELECT * FROM USER WHERE USERID > 200').
And I want to store the result set in a temporary table in the stored procedure.
Is this possible?
Thanks...
I want to run a select statement with EXEC keyword in my stored procedure.
For example EXEC ('SELECT * FROM USER WHERE USERID > 200').
And I want to store the result set in a temporary table in the stored procedure.
Is this possible?
Thanks...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
EXEC('Create TABLE #Holding (id int, name varchar(50)) INSERT INTO #Holding Select ID, name From SomeTable where userid>200')
Broken down...
Create TABLE #Holding (id int, name varchar(50))
INSERT INTO #Holding
Select ID, name From SomeTable where userid>200
regards,
KS