SQL Flow Field Guide

END (BEGIN...END)

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

groups statements into a block

What changes

Input
none
Output or change
none

Syntax at a glance

BEGIN { sql_statement | statement_block } END

Work example

A controlled task needs the behavior documented for END (BEGIN...END) before it is added to a batch.

Read the linked Microsoft syntax and test END (BEGIN...END) with synthetic input in an isolated database. Record its scope, permissions, and error path.

Check your work END (BEGIN...END). The observed END (BEGIN...END) behavior matches its written purpose and the test has no effect on permanent data or credentials.

Open Microsoft Learn for full syntax, permissions, and details for your version.