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?
Asked
Active
Viewed 2,978 times
0
-
Possible duplicate http://stackoverflow.com/questions/21058541/how-to-pass-output-parameter-to-a-stored-procedure – sam yi Feb 27 '14 at 21:22
1 Answers
5
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

M.Ali
- 67,945
- 13
- 101
- 127