Hi,
I have one stored procedure that calls another ( EXEC proc_abcd ). I would
like to return a result set (a temporary table I have created in the
procedure proc_abcd) to the calling procedure for further manipulation. How
can I do this given that TABLE variables cannot be passed into, or returned
from, a stored procedure?
Thanks,
Robin
Example: (if such a thing were possible):
DECLARE @myTempTable1 TABLE ( ID INT NOT NULL )
DECLARE @myTempTable2 TABLE ( ID INT NOT NULL )
.....
/*
Insert a test value into the first temporary table
*/
INSERT INTO @myTempTable1 VALUES ( 1234 )
.....
/*
Execute a stored procedure returning another temporary table of
values.
*/
EXEC proc_abcd @myTempTable2 OUTPUT
....
....
/*
Insert the values from the second temporary table into the first.
*/
SELECT * INTO @myTempTable1 FROM @myTempTable2
Comment