Site Search:
Sign in | Join | Help
4Penny.net

SQL Server (T-SQL)

Comments and notes on SQL Server 2000, 2005, and T-SQL

Creating a Stored Procedure with OUTPUT Parameters

Creating a stored procedure with an OUTPUT parameter is not a difficult task, but I have to do it quite often and it is convenient for me to blog it here, so that I have an easily accessible example

Create the stored prodecure like this:

CREATE PROCEDURE _4P_test
 
@intInput int,
@intOutput int OUTPUT

AS
set @intOutput = @intInput + 1 

go

Call it like this:

declare @intResult int
exec _4P_test 3 ,@intResult OUT
select @intResult

Comments

 

Kiran said:

Thanks for your suggestions it has helped me a lot

April 17, 2008 7:03 AM [Delete]
 

asif said:

thx buddy this helped me lot

July 11, 2008 6:22 AM [Delete]
 

deep del Campo said:

its a good example it  gives me an idea, ok.

August 5, 2008 3:40 AM [Delete]
 

vipul said:

Can we pass cursor as output parameter

August 11, 2008 9:21 AM [Delete]
 

vipul said:

Can we pass cursor as output parameter?

August 11, 2008 9:21 AM [Delete]
 

Steve Gray said:

Sadly, no. You might look at the new XML data type...

August 11, 2008 11:00 AM [Delete]
 

praveen said:

Thanks buddy.

I got idea on output parameter

September 27, 2008 12:45 PM [Delete]
 

jaldeep said:

hey thanks i understand the concept of sp output parameters............

September 30, 2008 12:59 PM [Delete]
 

himadri roy said:

is a good example but we need asp code to get this output value in my application

October 29, 2008 4:51 AM [Delete]
 

Vikranth said:

After searching lot of sites about the out parameters in Stored procedure.This  Example is the best one for who ever want to know.Thank you Steve Gray..

November 4, 2008 5:24 AM [Delete]

Leave a Comment

(required)  
(optional)
(required)  
Add

About Steve Gray

Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.