Specifies a compound statement.
BEGIN statement-list END
statement-list : sql-statement | variable-declaration | cursor-declaration | temporary-table-declaration
variable-declaration : see the DECLARE statement
cursor-declaration : see the DECLARE CURSOR statement
temporary-table-declaration : see the DECLARE LOCAL TEMPORARY TABLE statement
A list of statements and declarations.
A BEGIN statement allows one or more SQL statements to be grouped together and treated as a unit, and starts with the keyword BEGIN and ends with the keyword END.
Error handling is different for Transact-SQL compound statements.
None.
None.
BEGIN, which identifies a compound statement, comprises part of optional ANSI/ISO SQL Language Feature P002.
The example below declares the following variables:
BEGIN DECLARE v1 INT = 5 DECLARE v2, v3 CHAR(10) = 'abc' // ... END