SQL Flow Field Guide

GO

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

client-tool batch separator, not T-SQL

What changes

Input
none
Output or change
batch boundary; GO n repeats the batch

Syntax at a glance

GO [count]

Work example

A script needs a client-side batch boundary so declarations or module definitions start in a new batch.

Run the script in a tool that recognizes GO. Do not send GO to the SQL Server engine as a T-SQL statement.

Check your work The client submits the middle batch three times. The temporary table keeps all three rows, and the total is 9.

Practice SQL

Open in SQL Flow
CREATE TABLE #BatchLab (Quantity int);
GO
DECLARE @Quantity int = 3;
INSERT INTO #BatchLab VALUES (@Quantity);
GO 3
SELECT SUM(Quantity) AS Total FROM #BatchLab;
DROP TABLE #BatchLab;

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