Transact-SQL Reference

Control-of-Flow Language

The table shows the Transact-SQL control-of-flow keywords.

Keyword Description
BEGIN...END Defines a statement block.
BREAK Exits the innermost WHILE loop.
CONTINUE Restarts a WHILE loop.
GOTO label Continues processing at the statement following the label as defined by label.
IF...ELSE Defines conditional, and optionally, alternate execution when a condition is FALSE.
RETURN Exits unconditionally.
WAITFOR Sets a delay for statement execution.
WHILE Repeats statements while a specific condition is TRUE.

Other Transact-SQL statements that can be used with control-of-flow language statements are:

CASE

/*...*/ (Comment)

-- (Comment)

DECLARE @local_variable

EXECUTE

PRINT

RAISERROR