Control-of-Flow Language (T-SQL)

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:

/*...*/ (Comment) EXECUTE
-- (Comment) PRINT
CASE RAISERROR
DECLARE @local_variable  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.