Return Value from SP Using OUTPUT Parameter

Chikul
Posted by Chikul under Sql Server category on | Views : 2697
/*
Here spGetOutput is Having 2 parametes.
@ID : Input Param
@Name : Output Param

After Executing the SP . It Return @Name as OUTPUT Param.
*/

CREATE PROCEDURE spGetOutput
@ID INT = NULL,
@Name VARCHAR(200) OUTPUT
AS
BEGIN
IF @ID IS NOT NULL
BEGIN
SELECT @Name= UserName FROM tbUserMst WHERE UserID=@ID
END
ELSE
BEGIN
SELECT @Name= 'Please Provided the UserID.'
END
END

Comments or Responses

Login to post response