Tuesday, March 6, 2012

[mssql][ant] Failed to execute: GO

Hi,

I am trying to execute a simple sql file thru ant task. The file is:

use [centivaTest]
GO

However I get the errror message:
[sql] Failed to execute: use [centivaTest] GO

So I changed the file to:

use [centivaTest] ;
GO

as ant treats ';' as a delimiter. However another erro message
appears:

[mssql][ant] Failed to execute: GO

Do you know how to execute my simple sql statements thru ant (or
generally what wrong am I doing)?

Best regards,
Maciek Zywno"maciek zywno" wrote:

> I am trying to execute a simple sql file thru ant task. The file is:

<snip
> However I get the errror message:
> [sql] Failed to execute: use [centivaTest] GO

Maciek,

GO isn't understood by SQL Server: it's used as a batch delimiter for isql,
osql, and QA. I'm not an ant expert, but a few choices I see are:

- Have ant execute your SQL file via osql.

- Removed unnecessary GO's and/or manually break your script into separate
scripts (since that's what GO does anyway).

Craig

No comments:

Post a Comment