Groups | Blog | Home
all groups > sql server data mining > january 2004 >

sql server data mining : Process sp Result Set within another sp?


Richard K
1/22/2004 6:45:40 AM
I have a need to create an sp where inside that sp I make
a call to another sp passing in the appropriate
parameters then have that result set be used in a cursor
set that I can then walk in the calling sp.

Does anyone have any sample code I can see?

Thanks!!

-Richard K
Jamie MacLennan (MS)
1/22/2004 10:32:36 AM
Forwarding
[quoted text, click to view]

Satish Balusa
1/22/2004 1:32:26 PM
One of the options is by using a Temp Table either #Table or @Table
dependin upon your requirement.
Else evalute, if you could use a User-Defined Functions That Return a table
Data Type

--
HTH
Satish Balusa
Corillian Corp.


[quoted text, click to view]

Noah Ganter
2/4/2004 8:33:51 AM
The syntax of the code is kind of whacky, but in TSQL you can include a
parameter when creating an sp that is designated as OUTPUT. This value will
be available after the procedure is called, but when it is called you need
to designate a variable that is equal to that output parameter,
as follows:

CREATE PROCEDURE sp_out @outvar INT OUTPUT AS
SELECT @outvar=1
GO

declare @lvar INT

exec sp_out @outvar=@lvar OUTPUT
Print @lvar

@lvar will now hold the output of sp_out!

-Noah Ganter

[quoted text, click to view]
Response'></HEAD></HTML>

AddThis Social Bookmark Button