If a specific condition occurs, you can use the GOTO statement to run the code in a given label. The use is as follows.
1 2 3 4 5 6 7 8 9 10 |
DECLARE @testvariable int=1 WHILE(@testvariable<10) BEGIN Select @testvariable SET @testvariable+=1; IF(@testvariable=1) GOTO your_label_name END your_label_name: PRINT 'dbtut.com is 1 years old.' |