Link to home
Start Free TrialLog in
Avatar of Michael Krumpe
Michael KrumpeFlag for United States of America

asked on

Multiple Output parameters in a stored proceedure

How do I format a stored proceedure to return multiple return parameters?

I just need to see a simple example.

(In a rush to search for the answer)
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
CREATE PROCEDURE procName
    @inputParam1 INT,
    @inputParam2 INT,
    @outputParam1 VARCHAR(30) = NULL OUTPUT,
    @outputParam2 INT = NULL OUTPUT,
    @outputParam3 DATETIME = NULL OUTPUT
AS
...
create procedure testSp11
@i int ,
@j int,
@sum int output,
@diff int output
as
BEGIN

select @sum = @i +@j
       ,@diff = @i - @j

END


GO

declare @su int, @dif int
exec testSP11 20,10,@su out,@dif out
select @su,@dif
Avatar of Michael Krumpe

ASKER

Thanks angelIII... the simple answer always works the best!