I am familiar with Goto Command since i was using Visual Basic 6.0.
I wanted to prevent or bypass the execution in a stored procedure and i used the same command in Sql Server 2005.
GOTO skip and processing continues at the label.
GOTO statements can be used any where in the procedure and statement block.
EXAMPLEDECLARE @CLASS INT
SET @CLASS = 4
IF @CLASS = 4
SELECT ‘Jumping To Class1.’
SELECT ‘Jumping To Class2.’
SELECT ‘Jumping To Class3.’
SELECT ‘Jumping To Class4.’
SELECT ‘Jumping To Class5.’