Stored procedures with output parameters

 


Creating and execute Stored Procedure with output parameters


create procedure getemployeecoutbyaddress

@address varchar(20),

@Empcount int output

as begin

select @Empcount=count(Emp_ID) from tblemployee where Address=@address

end


To Execute the stored procedure with output parameters

declare @totalemployee int

exec getemployeecoutbyaddress 'noida',@totalemployee output

print @totalemployee


if you don't specified the output keyword, when execute the stored procedure @totalemployee value will be null


Sp_help procedure name:- View the information

 About the stored procedure like parameters name, their data type etc. Sp_help can be use with database object like table view etc. Alternative you can also press Art+F1