Home > DeveloperSection > Forums > use output parameter in stored procedure
Ankit Singh

Total Post:341

Posted on    December-07-2015 9:24 PM

 Database SQL Server  SQL  SQL Server 2008  SQL Server 2012 

 1 Reply(s)
 335  View(s)
Rate this:
 I want to use output parameter in stored procedure please help me.

aditya kumar Patel

Total Post:250

Posted on    December-07-2015 9:27 PM

Setting up output paramters for a stored procedure is basically the same as setting up input parameters, the only difference is that you use the OUTPUT clause after the parameter name to specify that it should return a value.  The output clause can be specified by either using the keyword "OUTPUT" or just "OUT".

create proc Sp_EmpData


@totalcount int output




select @totalcount=(select count(*) from Employee);


DECLARE @totalcount int

EXEC Sp_EmpData @totalcount = @totalcount OUTPUT

select @totalcount

Don't want to miss updates? Please click the below button!

Follow MindStick