May 24, 2004 #1 5679 Programmer Joined Feb 14, 2003 Messages 32 Location AU I need to write a stored procedure with two output parameters. Please give me an example or an idea.
May 24, 2004 #2 tb Programmer Joined May 27, 2003 Messages 328 Have you searched in BOL ? I typed in .. output parameters and got a whole load .. CREATE PROCEDURE myProc @inparam int, @outparam int OUTPUT I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me! Upvote 0 Downvote
Have you searched in BOL ? I typed in .. output parameters and got a whole load .. CREATE PROCEDURE myProc @inparam int, @outparam int OUTPUT I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!
May 25, 2004 #3 VintageWine IS-IT--Management Joined Sep 18, 2002 Messages 191 Location GB You also need to specify OUTPUT when calling the stored procedure. e.g. Code: CREATE PROCEDURE myProc @inparam int, @outparam1 int OUTPUT, @outparam2 int OUTPUT AS SELECT @outparam1=49*@inparam SELECT @outparam2=49*@outparam2 Calling script/procedure Code: DECLARE @q1 integer, @q2 integer SELECT @q2=4 EXECUTE myProc 100, @q1 OUTPUT, @q2 OUTPUT SELECT @q1, @q2 Above returns a single row: 4900 196 Have fun Simon Upvote 0 Downvote
You also need to specify OUTPUT when calling the stored procedure. e.g. Code: CREATE PROCEDURE myProc @inparam int, @outparam1 int OUTPUT, @outparam2 int OUTPUT AS SELECT @outparam1=49*@inparam SELECT @outparam2=49*@outparam2 Calling script/procedure Code: DECLARE @q1 integer, @q2 integer SELECT @q2=4 EXECUTE myProc 100, @q1 OUTPUT, @q2 OUTPUT SELECT @q1, @q2 Above returns a single row: 4900 196 Have fun Simon