BREAK Statement
Terminates the enclosing
WHILE or
FOR loop. It is an error to
call
BREAK outside of a
WHILE or
FOR loop.
Syntax
BREAK;
Example
-- Prints the numbers 1 to 10.
DECLARE @counter = 1;
WHILE 1 BEGIN
PRINT @counter;
SET @counter = @counter + 1;
IF @counter > 10
BREAK;
END
See Also