views:

315

answers:

1

Is there a way to work on a recordset returned from an exec within another SP? The whole recordset, preferably not using OUTPUT

I.E.

MyStoredProcedure @var1 int AS BEGIN

EXEC anotherSP @var1

-- do something against the recordset returned by anotherSP

END

+1  A: 
CREATE PROC MyStoredProcedure
    @var1 int
AS
BEGIN
DECLARE #temp (
col1 ...
)

INSERT #temp
EXEC anotherSP @var1

-- do something against #temp

END

A table variable also wokrs in SQL 2005 and above. temp tables only for SQL 2000.

gbn