GO

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

Syntax
      GO [--comment]

Key
   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.

Example

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
Equivalent Oracle (SQL*Plus) command: STA[RT] - Run an SQL Script (@)


© Copyright SS64.com 1999-2014
Some rights reserved