Counter of Festivals

Ashok Blog for SQL Learners and Beginners and Experts

Thursday 28 February 2013

Execute Stored Procedure with Output Parameter?

Execute Stored Procedure with Output Parameter?


select * from empdet



Creating Stored procedures with Output parameter:

create proc getempmgr
@empid int,
@mgrid int output
as
begin

select @mgrid=mgr
from empdet
where empno=@empid
end
Executing Stored Procedures with output parameter:

exec getempmgr 7566,@r output

select @r


declare @s int

exec getempmgr 7698,@mgrid=@s out

select @s


declare @t int

exec getempmgr @empid=7698,@mgrid=@t out

select @t




No comments:

Post a Comment