Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored Procedure ResultSets

Author  Topic 

CPaiva
Starting Member

1 Post

Posted - 2003-10-16 : 06:09:36
Hi,
I'd like to know, if is any way of working in the resultset of a stored procedure, within another stored procedure!

Say,just to show :

Sp1
...
SELECT * FROM <TABLE>

and in SP2
...
set @ResulTable = exec Sp1

so I can parse the result set created in SP1

I'm doing this by :

CREATE TABLE #temp (<Result Set definition>)
INSERT #Temp EXEC Sp1

Is this the only way?, i'm trying to NOT use temp table!
By the way, I do not want to pass a CURSOR parameter, cos SP1
is used for other purposes (To fill a grid).

Tanks in advance for your help

Regards,

Carlos Paiva

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-10-16 : 06:52:34
The temp table is your only option. You are doing it the right way.


Damian
Go to Top of Page

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2003-10-16 : 06:53:28
As I know this is really the only way... insert... then retrieve.
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-10-16 : 08:38:45
I doubt it'll save much, but you could write a function that returns a table .

Sam
Go to Top of Page

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2003-10-21 : 16:16:20
Also,

select * from
openrowset('sqloledb','(local)';'sa';'pwd','exec myDB..mySP')
Go to Top of Page
   

- Advertisement -