break

Causes an exit from a while loop. break is often activated by an if test.

Syntax

while logical_expression 
	statement 
break 
	statement 
continue

Parameters

Examples

Usage

  • break causes an exit from a while loop. Statements that appear after the keyword end, which marks the end of the loop, are then executed.

  • If two or more while loops are nested, the inner break exits to the next outermost loop. First, all the statements after the end of the inner loop run; then, the next outermost loop restarts.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

No permission is required to use break.

Related reference
continue
select
while