goto label

Branches to a user-defined label.

Syntax

label: 
	goto label

Examples

Usage

  • The label name must conform to the rules for identifiers and must be followed by a colon (:) when it is declared. It is not followed by a colon when it is used with goto.

  • Make the goto dependent on an if or while test, or some other condition, to avoid an endless loop between goto and the label.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

No permission is required to use goto.

Related reference
if...else
while