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]

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.