Re: Connecting to SQL Server Express 2005
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Thu, 9 Jul 2009 09:05:46 +0000 (UTC)
hedera (hedera@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
After reading all the references you gave me in your last post, I
thought I might be able to take the script for sp_help_revlogin from the
Microsoft KB (which was referenced in the very useful DataBase Journal
article), and run it against my production database, and then run the
generated script against my test database. I even made a minor mod to
restrict the changes only to my database, since I'm on a shared server
(correctly, I'm sure - I'm VERY careful about typing code and I checked
it 3 times!). The SQL server produced the following list of errors:
The following error occured while executing the query:
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near 'GO'.
Line 5: Incorrect syntax near 'GO'.
'CREATE PROCEDURE' must be the first statement in a query batch.
How did you run the script?
Here's the scoop: GO is not part of the SQL syntax, but query tools
such as Management studio reacts on the GO, and splits up the input
in batches for each GO that is on a line of its own. Each batch is
then sent separately to SQL Server.
So if you get syntax error because of the GO, there is something that is
not the way it usually is. I can think of three reasons:
1) You are running the script from a tool that does not intercept the GO.
2) You have reconfigured the tool to use a different batch separator.
3) You have somehow mutilated the script so that the GO are no longer
on a line on its own.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- Follow-Ups:
- Re: Connecting to SQL Server Express 2005
- From: hedera
- Re: Connecting to SQL Server Express 2005
- References:
- Connecting to SQL Server Express 2005
- From: hedera
- Re: Connecting to SQL Server Express 2005
- From: Sylvain Lafontaine
- Re: Connecting to SQL Server Express 2005
- From: hedera
- Re: Connecting to SQL Server Express 2005
- From: Sylvain Lafontaine
- Re: Connecting to SQL Server Express 2005
- From: Sylvain Lafontaine
- Re: Connecting to SQL Server Express 2005
- From: hedera
- Re: Connecting to SQL Server Express 2005
- From: Sylvain Lafontaine
- Re: Connecting to SQL Server Express 2005
- From: hedera
- Connecting to SQL Server Express 2005
- Prev by Date: Re: Connecting to SQL Server Express 2005
- Next by Date: Re: Connecting to SQL Server Express 2005
- Previous by thread: Re: Connecting to SQL Server Express 2005
- Next by thread: Re: Connecting to SQL Server Express 2005
- Index(es):
Relevant Pages
|