Thursday, 22 March 2018

How to pass OUTPUT parameter in MS SQL StoreProcedure

Description : In this post how to pass OUTPUT parameter in procedure and how to return value from procedure

- Create Simple StoreProcedure

CREATE PROCEDURE [dbo].[MyOUTPUTParamCheck]
    @Name Varchar(100)
    ,@OUTPARAMETER Varchar(100) OUTPUT
AS
BEGIN
    SET NOCOUNT ON;

        SET @OUTPARAMETER = 'Hi ' + @Name

    PRINT @OUTPARAMETER
END

- Call procedure

[dbo].[MyOUTPUTParamCheck] 'Test',''

- Result : Hi Test

No comments:

Post a Comment