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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i execute one stored procedure in another stored procedure

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi

I want to execute one stored procedure in another stored procedure in sql server 2000.
I am trying get input of another stored procedure as output of first stored procedure. I am using DDL command as(Select) in second stored procedure.

I tried it but i am getting error in second procedure error as " Could not find first stored procedure name ".

Can u please send me reply immd...
 
SQL snippets? codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
Dear ,

Please, post your SQL Code here so that we can find the Problem with it.

But, which I understand from your Question is that , you have two SP like following ones.

--*********** SP # 1 *************
Create Procedure stp_SP1
@P_INPUT1 int

AS

SET NOCOUNT ON
BEGIN

Select * from ADM_BTN_Buttons Where ButtonID = @P_INPUT1

END

--*********** SP # 2 *************

Create Procedure stp_SP2
@P_OUT_INPUT1 int OUTPUT

AS

SET NOCOUNT ON
BEGIN

Select @P_OUT_INPUT1 = 863

END

--***************************

I tried these SP's in this way

Declare @L_OUT_INPUT1 int
Exec stp_SP1 Exec stp_SP2 @L_OUT_INPUT1 OUTPUT

But it gave me error:

Server: Msg 201, Level 16, State 3, Procedure stp_SP1, Line 0
Procedure 'stp_SP1' expects parameter '@P_INPUT1', which was not supplied.

But when I used following then I ran and which is obvious:

Declare @L_OUT_INPUT1 int
Exec stp_SP2 @L_OUT_INPUT1 OUTPUT
Exec stp_SP1 @L_OUT_INPUT1

I gave me my resultset :
ButtonID ButtonDescription so on.
863 Removable Button Strips .............

I think you can also try this method.


Regards,
essa2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top