|
Home > Archive > MS SQL Server > October 2006 > How does SQL Server Management Studio count query lines?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How does SQL Server Management Studio count query lines?
|
|
| Keithb 2006-10-24, 6:37 pm |
| How does SQL Server Management Studio count query lines? Running table
creation scripts on a 2000 instance using scripts created in 2005, I get the
error messages shown below. There are no '(' characters on the designated
lines. Furthemore, if delete the designated lines and parse the script
again, I get the same error messages. What is going on?
Thanks,
Keith
Msg 170, Level 15, State 1, Line 8
Line 8: Incorrect syntax near '('.
Msg 170, Level 15, State 1, Line 20
Line 20: Incorrect syntax near '('.
Msg 170, Level 15, State 1, Line 31
Line 31: Incorrect syntax near '('.
Msg 170, Level 15, State 1, Line 44
Line 44: Incorrect syntax near '('.
Msg 170, Level 15, State 1, Line 57
Line 57: Incorrect syntax near '('.
Msg 170, Level 15, State 1, Line 68
Line 68: Incorrect syntax near '('.
| |
|
|
My experience is that is usually tells you the correct line, look at the
status bar at the bottom for the line number.
Also make sure you don't have parts of the query selected when executing,
for some reason they seemed to think it was a good feature to have it
execute only the selected area by default, mostly it's just annoying.
KL.
"Keithb" <noreply@dslextreme.com> skrev i meddelandet
news:e7upqyu7GHA.1252@TK2MSFTNGP04.phx.gbl...
> How does SQL Server Management Studio count query lines? Running table
> creation scripts on a 2000 instance using scripts created in 2005, I get
> the error messages shown below. There are no '(' characters on the
> designated lines. Furthemore, if delete the designated lines and parse the
> script again, I get the same error messages. What is going on?
>
> Thanks,
>
> Keith
> Msg 170, Level 15, State 1, Line 8
>
> Line 8: Incorrect syntax near '('.
>
> Msg 170, Level 15, State 1, Line 20
>
> Line 20: Incorrect syntax near '('.
>
> Msg 170, Level 15, State 1, Line 31
>
> Line 31: Incorrect syntax near '('.
>
> Msg 170, Level 15, State 1, Line 44
>
> Line 44: Incorrect syntax near '('.
>
> Msg 170, Level 15, State 1, Line 57
>
> Line 57: Incorrect syntax near '('.
>
> Msg 170, Level 15, State 1, Line 68
>
> Line 68: Incorrect syntax near '('.
>
>
| |
| Tracy McKibben 2006-10-24, 6:37 pm |
| Keithb wrote:
> How does SQL Server Management Studio count query lines? Running table
> creation scripts on a 2000 instance using scripts created in 2005, I get the
> error messages shown below. There are no '(' characters on the designated
> lines. Furthemore, if delete the designated lines and parse the script
> again, I get the same error messages. What is going on?
>
> Thanks,
>
> Keith
> Msg 170, Level 15, State 1, Line 8
>
> Line 8: Incorrect syntax near '('.
>
> Msg 170, Level 15, State 1, Line 20
>
> Line 20: Incorrect syntax near '('.
>
> Msg 170, Level 15, State 1, Line 31
>
> Line 31: Incorrect syntax near '('.
>
> Msg 170, Level 15, State 1, Line 44
>
> Line 44: Incorrect syntax near '('.
>
> Msg 170, Level 15, State 1, Line 57
>
> Line 57: Incorrect syntax near '('.
>
> Msg 170, Level 15, State 1, Line 68
>
> Line 68: Incorrect syntax near '('.
You can double-click on the error message and be taken to the offending
line of code.
Also, consider the following:
Line 1: SELECT *
Line 2: FROM MyTable
Line 3: ORDER BY Col1
An error on any of these lines is going to report that the error is on
Line 1.
| |
| Hugo Kornelis 2006-10-24, 6:37 pm |
| On Fri, 13 Oct 2006 10:26:05 -0700, Keithb wrote:
>How does SQL Server Management Studio count query lines?
In addition to the replies already given by KL and Tracy, SQL Server
will also reset the line counter after each GO. That's because GO is a
batch seperator - whenever SSMS encounters a GO, it sends all preceding
lines as a single batch to SQL Server, waits for the reply, then goes on
to the next batch.
--
Hugo Kornelis, SQL Server MVP
|
|
|
|
|