[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

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)
0
Michael Krumpe
Asked:
Michael Krumpe
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
create procedure proc_name
  @param1 int output
 , @param2 varchar(20) output
  ...etc.
as
  set @param1 = 2
  set @param2 = 'vdkjdf'
0
 
Scott PletcherSenior DBACommented:
CREATE PROCEDURE procName
    @inputParam1 INT,
    @inputParam2 INT,
    @outputParam1 VARCHAR(30) = NULL OUTPUT,
    @outputParam2 INT = NULL OUTPUT,
    @outputParam3 DATETIME = NULL OUTPUT
AS
...
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
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
0
 
Michael KrumpeSolutions ArchitectAuthor Commented:
Thanks angelIII... the simple answer always works the best!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now