Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: isql -- executing multiple input scripts



[EMAIL PROTECTED] (Alex Vilner) wrote in message news:<[EMAIL PROTECTED]>...
> Have an issue with this:
> 
> 
> 1> 80> 159> 361> 415> 447> Msg 170, Level 15, State 1, Server DEVSQL01, Line 4
> Line 4: Incorrect syntax near 'GO'.
> Msg 170, Level 15, State 1, Server DEVSQL01, Line 7
> Line 7: Incorrect syntax near 'GO'.
> Msg 111, Level 15, State 1, Server DEVSQL01, Line 14
> 'CREATE PROCEDURE' must be the first statement in a query batch.
> .....
> 
> The script for procedure creation has tis general structure:
> /* description */
> if exists ...
>  drop procedure
> go
> 
> SET ...
> SET ...
> 
> /* comment */
> create procedure ...
> go
> 
> It does not seem to like the GOs inside the scripts... This is using isql.
> 
> Any other hints/suggestions?
> 
> Thanks!
> 

Without seeing the whole script, it's not clear why you have
"incorrect syntax" errors, however the third error is clear - CREATE
PROC must be the first statement in a batch. You have two SET
statements, then CREATE PROC. If you use Enterprise Manager or Query
Analyzer to generate the CREATE PROC script, you'll see how it
separates these statements into separate batches:

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
if exists ...
GO
CREATE procedure dbo.SomeProc
...
GO


Simon



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.