>>>>I didn't imply, you did :) But how should I access the result set? If I want to join it with another resultset in the upper level SP?
>>>
>>>You can create temp. table before you run dynamic SQL which in turn will store result recordset into that temp. table.
>>
>>I see.
>>create table ...
>>call SecondLevelSP with this table as output cursor
>
>I'm not familiar with "table as output cursor" in SQL Server.
>
INSERT INTO #temptable SELECT FROM ...
-- create the store procedure
CREATE PROCEDURE <procedure_name, sysname, proc_test>
<@proc_cursor_name, , @proc_test_cursor> CURSOR VARYING OUTPUT
AS
SET <@proc_cursor_name, , @proc_test_cursor> = CURSOR FOR
<select_statement, , select 1>
OPEN <@proc_cursor_name, , @proc_test_cursor>
GO
Could you please elaborate more on your idea? I'm working on this SP right now through PCAnywhere
If it's not broken, fix it until it is.
My Blog