CREATE PROCEDURE NUV
@TEST NVARCHAR(100)
AS BEGIN
IF @TEST='DHINAKARAN' GOTO DHINAKARAN --JUMPS TO DHINAKARAN LABEL.
IF @TEST='BHARATH' GOTO BHARATH -- JUMPS TO LABEL NAMED BHARATH
IF @TEST='JOB' GOTO JOB -- JUMPS TO LABEL NAMED JOB
DHINAKARAN:--LABEL DECLARATION AND ITS FOLLOWING COMMAND
PRINT 'DHINAKARAN IS A ASSOCIATE ETL DEVELOPER
AT NUVENTO SYSTEMS PVT LTD JOINED IN 2011, NOVEMBER'
GOTO FINISH -- THIS IS USED TO PREVENT LABEL BHARATH WHICH IS BELOW FROM EXECUTING
BHARATH:
PRINT 'BHARATH IS A SNR ETL DEVELOPER AT NUVENTO SYSTEMS JOINED IN 2009, MARCH'
GOTO FINISH -- THIS IS USED TO PREVENT LABEL JOB WHICH IS BELOW FROM EXECUTING
JOB: PRINT 'JOB IS A ETL DEVELOPER AT NUVENTO SYSTEMS JOINED IN 2010, JULY'
GOTO FINISH
FINISH:
END
After running this stored procedure, if we try to execute with either of the name mentioned above like bharath, dhinakaran, job, you will get printed version which is mentioned in label.
Example and its snippet is shown below.
If we give EXEC NUV 'DHINAKARAN', Then output will be "DHINAKARAN IS A ASSOCIATE ETL DEVELOPER
AT NUVENTO SYSTEMS PVT LTD JOINED IN 2011, NOVEMBER"
Comments
Post a Comment