GO

Send the current batch of T-SQL statements to an instance of SQL Server.

Syntax
      GO count [--comment]

Key
   count       A positive integer.
               The batch preceding GO will execute the specified number of times.

   comment    Optional comment text.

The scope of local (user-defined) variables is limited to a batch, and cannot be referenced after a GO command.
Execution of a stored procedure after the first statement in a batch must include the EXECUTE keyword.

Examples

DECLARE @MyString VARCHAR(20)
SELECT @MyString = 'Hello World' PRINT @MyString GO -- Next line will error because the variable was declared before this batch. PRINT @MyString GO

“Do not go gentle into that good night” ~ Dylan Thomas

Related commands

COMMIT - Mark the end of a transaction.


 
Copyright © 1999-2026 SS64.com
Some rights reserved