Use of OUTPUT ….

/*Create one SP for multiplicating two values.And passed the result into the variable @v2*/
CREATE PROCEDURE SP_REF
–DECLARE @V1 VARCHAR(50)
@V2 BIGINT OUTPUT
AS
SELECT @V2=@V2*@V2
RETURN
–drop procedure SP_REF
/*Passed the result of the variable in to @v1 and executed.*/
DECLARE @V1 VARCHAR(50)
SELECT @V1=10000
EXEC SP_REF @V1 OUTPUT
PRINT ‘RESULT:’+@V1
/*Create one SP for multiplicating two values.And passed the result into the variable @v2*/
CREATE PROCEDURE SP_REF
–DECLARE @V1 VARCHAR(50)
@V2 BIGINT OUTPUT
AS
SELECT @V2=@V2*@V2
RETURN
–drop procedure SP_REF
/*Passed the result of the variable in to @v1 and executed.*/
DECLARE @V1 VARCHAR(50)
SELECT @V1=10000
EXEC SP_REF @V1 OUTPUT
PRINT ‘RESULT:’+@V1
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.