Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

return Vars from SP to another SP

Status
Not open for further replies.

kifaro

Programmer
Oct 4, 2002
54
US
hey how do I call a stored proc from withing a stored proc that returns :
select 1,2,3
-- I need all 3 vars

Thanks,
Aaron
 
I'm not sure I understand your question. Does the following help? If not please provide more detailed info.

Create Proc SimpleSample
@var1 int Output, @var2 Int Output, @var3 int Output
As
Select @var1=1, @var2=2, @var3=3
go

In other stored procedure execute the following.

Declare @p1 int, @p2 int, @p3 int

Exec SimpleSample @var1=@p1 Output, @var2=@p1 Output, @var3=@p3 Output

--Use @p1, @p2, and @p3 later in the procedure If you want to get the best answer for your question read faq183-874 and faq183-3179.
Terry L. Broadbent - DBA
SQL Server Page:
 
The stored proc is already written. Currenty I don't have output parameters, just returning a recordset, which in reality is just just one record. I was hoping I could do this without adding more parameters for output.

Aaron
 
Exactly, but now how do you call SimpleSample from another proc and return all the vars without output params

Aaron
 
Hi,

I'm looking for the same thing I think. I just don't know the syntax (or if it's possible) to call StoredProcB from StoredProcA. I would want StoredProcA to send in two parameters and StoredProcB to return one variable. I can give more specifics if anyone is available to help.

Thanks!
Sheri
 
Create Procedure StoredProcA
As
Declare @varout int

--Execute 2nd SP with two input variables and one output variable
Exec StoredProcB
@var1='abc', @var2=100, @var3=@varout Output

Print @varout

See "CREATE PROCEDURE" SQL Books Online for more information.




If you want to get the best answer for your question read faq183-874 and faq183-3179.
Terry L. Broadbent - DBA
SQL Server Page:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top