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)
 store return value from one sp into another sp

Author  Topic 

mmdullah
Starting Member

10 Posts

Posted - 2009-10-15 : 01:53:36
how to catch recordset in an sp that calls another sp.

the scenario is like this:


create procedure sp_callee
/* parametr list*/
as
begin
select * from Employee
/* exact code is more complex*/
end

create procedure sp_caller
as
begin
declare @retVal table
(
-- as same columns as in Employee table
)
-- my question is how to store result from sp_callee into @retVal
insert into @retVal select * from
(
exec sp_callee /* parameter list*/
)
end
urgent need. any help will be appriciated.
thanks in advance

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-10-15 : 01:56:54
[code]
insert into @retVal exec sp_callee
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-15 : 02:56:19
Note that SELECT * FROM (EXEC proc) is not possible until you use OPENROWSET
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -