all groups > sql server programming > november 2003 >
You're in the

sql server programming

group:

Using results of a nested procedure



Using results of a nested procedure Mike
11/3/2003 11:55:36 PM
sql server programming: Say one stored procedure returns information in a table
(like "select * from MyTable"). How would a second
procedure, which calls the first one, access this
information?

Example:
-------------------------------
create procedure sp1
as
select * from myTable
go
-------------------------------
create procedure sp2
as
-- Here I want to obtain the recordset from sp1 and
iterate through the rows. Ideally, it would be great to
pass somehow the data to a table local to sp2.
go
-------------------------------

Thanks,
Mike
Re: Using results of a nested procedure anonymous NO[at]SPAM discussions.microsoft.com
11/4/2003 12:38:05 AM
It did! Thank you.

Mike

[quoted text, click to view]
Re: Using results of a nested procedure Cristian Babu
11/4/2003 10:10:42 AM
Try this:

create table MyTable(Col1 int, Col2 int)
go
insert into MyTable values (1, 1)
insert into MyTable values (2, 2)
insert into MyTable values (3, 3)
go
create procedure proc1 as
select * from MyTable
go
create procedure proc2 as
create table #t(Col1 int, Col2 int)
insert into #t exec proc1
select * from #t
drop table #t
go
proc2
go

Hope this helps,
Cristian Babu
CCNA

Re: Using results of a nested procedure Pavel S.Vorontsov
11/4/2003 2:00:42 PM
use temp table or OPENROWSET

[quoted text, click to view]

AddThis Social Bookmark Button