how to call a procedure with output parameter in sql server 2008

Posted by Shanky11 under Sql Server on 7/4/2013 | Points: 10 | Views : 736 | Status : [Member] | Replies : 1
table column is
studentid sname firstname lastname emailid


i have created a procedure
create procedure getstudentname
(
@studentid int,
@studentname VARCHAR(200) OUT
)
AS
BEGIN
SELECT @studentname= Firstname+' '+Lastname FROM student_demo WHERE studentid=@studentid
END
now how can i call this procedure in sql




Responses

Posted by: Pandians on: 7/4/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Check it Out!

Once created the Procedure
DECLARE @studentname_Out VARCHAR(200)

EXEC getstudentname 101,@studentname = @studentname_Out
SELECT @studentname_Out [Student Name]
GO


Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response