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 2005 Forums
 Transact-SQL (2005)
 How to pass a recordset to the calling SP

Author  Topic 

awk_grep
Starting Member

11 Posts

Posted - 2007-12-14 : 14:10:00
* I have posted this issue under Sql/Server 2000 as well.. but I am woreking on 2005...
*

I have two Stored Procedures. let say sp_a and Sp_b. Sp_a calls Sp_b using the EXEC... my issue is that Sp_B will produce a recordset, like 4 rows and 5 columns...

How can I have the data from sp_b passed back to the calling SP..?
here is some of the code..
-----------------------------
OPEN @cursor_var
set @cnt = 0
set @cnt = @cnt + 1
while (@cnt <= @@cursor_rows)
begin
fetch next from @cursor_var into @emp_loop_id , @daytime
exec SP_B @emp_loop_id,'10/22/2007' ,@emp_id_out output , @total_time_perday output

set @cnt = @cnt + 1
end
--------------------
Once the SP_B is called , the SP_B will create a record set the result from calling SP_B is 4 records or 5 records.

How can I get a record set back from calling SP_B? If I call the SP_B by itself , it will return 4 rows and 5 columns How can I get these results back from calling EXEC SP_B? can it be done?


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-12-14 : 14:20:04
Locking this duplicate thread. Will move the other thread to the 2005 forum.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -