/***************************************************************** T-SQL WHILE loop demonstration with BREAK and CONTINUE. A loop that increments av value from 0 to 10 and prints it. At 7, the CONTINUE statement is demonstrated. 7 is never printed, since CONTINUE restarts the loop. At 9, the BREAK statement is demostrated. 9 and 10 is never printed, since break exits the loop. *****************************************************************/ DECLARE @COUNTER INT = 0 WHILE @COUNTER < 10 BEGIN SET @COUNTER = @COUNTER + 1 IF @COUNTER = 7 CONTINUE IF @COUNTER = 9 BREAK PRINT @COUNTER END