Re: Connecting to SQL Server Express 2005



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

.



Relevant Pages

  • Re: Cannot Open SQL Server Table in Access.ADP File.
    ... Other possiblities would be that you didn't refresh the database window ... I have an SQL Server 2005 database which functions properly with my ... the Generate Script Wizard to recreate the SQL Server Database. ... Then, If I attempt to open another table, it opens. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: SQL Security
    ... except I'm having problems making it work in a script. ... ;Set properties of DB objects and open connection to database ... > from Books Online (within the SQL Server program group): ... > communicate with SQL Server. ...
    (microsoft.public.sqlserver.server)
  • RE: Project Server 2003
    ... when I got to the run script step, I ran the script from the copied database ... I was also wondering about the create database ... For example, type Project Server, and then click OK. ... In the left pane of SQL Server Management Studio, expand Databases, ...
    (microsoft.public.windows.server.sbs)
  • Re: Database Access
    ... Do you create the group in SQL Server on the NT Domain? ... >> from a client script to ... > the database server would not be possible from client machines. ... You will want the sqloledb connection string. ...
    (microsoft.public.scripting.jscript)
  • SQL Server 2005 differences....
    ... when I attempt to create the same database under SQL Server 2005 Beta 2 I ... get an error "Incorrect syntax near UPDLOCK". ... (ROWLOCK UPDLOCK). ...
    (microsoft.public.access.adp.sqlserver)

Quantcast