muttley91
muttley91

Reputation: 12674

Capture Return Value of Stored Procedure from Within Another Stored Procedure

I'm calling one stored procedure from within another. I have some return values (integers) specified in SP1. I'd like to call SP1 from within SP2 and be able to capture those return values (and do actions based on what they are). How can I do this?

Upvotes: 0

Views: 3156

Answers (1)

M.Ali
M.Ali

Reputation: 69524

CREATE PROCEDURE  UPS_2
@Var1 Datatype,    --<-- Variables you need to execute SP1
@Var2 Datatype,
@Var3 Datatype     --<-- Also Variables you need to execute this proc
AS
BEGIN
 SET NOCOUNT ON;

 DECLARE @Rtn_Var Datatype;  

  EXECUTE @Rtn_Var = dbo.SP1 @Var1

  /* Now you can use returned Values from SP1 Inside this proc */


  /* Do other cool stuff here  */

END

Upvotes: 5

Related Questions