PRB: GO as 1st Word on Line Treated as Batch Terminator

Last reviewed: May 2, 1997
Article ID: Q141666

The information in this article applies to:
  • Microsoft SQL Server, version 6.0

SYMPTOMS

When you use ISQL/W or Query Analyzer in SQL Enterprise Manager (SEM), if the word GO appears as the first word on a new line of an SQL script it is treated as an end-of-batch signal, regardless of whether or not it is followed by non-space characters on the same line.

WORKAROUND

Have GO as the first word on a line only if you intend it to be the batch terminator; otherwise, make sure you have one or more non-space characters before the word GO on the same line. Command-line ISQL, which treats a GO on a line all by itself as the end-of-batch signal, does not have this problem. You can change the command terminator with the /c option of ISQL.

MORE INFORMATION

Consider the INSERT statement in the following script. The string to be inserted has a GO on a new line. Running this script results in syntax errors. If you replace the word GO with another word, say COME, the string will be successfully inserted.

create table t1(x char(20)) go insert into t1 values ('PLEASE GO HOME')

Similarly, the following comment will also generate syntax errors:

/*
GO TO LABEL1
*/


Additional query words: sql6 error syntax
Keywords : kbtool SSrvEntMan
Version : 6.0
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.