When I try to execute file containing
IF (object_id(N'dbo.spInterfaceKkkV201105KlientSzukaj','P') IS NOT NULL)
BEGIN
DROP PROCEDURE [dbo].[spInterfaceKkkV201105KlientSzukaj]
END
GO
(it is correctly executed from Ms server management studio console)
I get error
[INFO] [sql:execute {execution: create-data}]
[INFO] Executing file: c:\svn\eai\sqlMavenPlugin\main\sql\eai\firstTest.sql
[ERROR] Failed to execute: IF
(object_id(N'dbo.spInterfaceKkkV201105KlientSzukaj','P') IS NOT NULL)
BEGIN
DROP PROCEDURE [dbo].[spInterfaceKkkV201105KlientSzukaj]
END
GO
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Incorrect syntax near 'GO'.
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Incorrect syntax
near 'GO'.
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Incorrect syntax
near 'GO'.
at org.codehaus.mojo.sql.SqlExecMojo.execute(SqlExecMojo.java:640)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect
syntax near 'GO'.
at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
at
com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
at
com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:775)
at
com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:676)
at
com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
at
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
at
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
at
com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:649)
at org.codehaus.mojo.sql.SqlExecMojo.execSQL(SqlExecMojo.java:1050)
at
org.codehaus.mojo.sql.SqlExecMojo.runStatements(SqlExecMojo.java:1013)
at org.codehaus.mojo.sql.SqlExecMojo.access$200(SqlExecMojo.java:67)
at
org.codehaus.mojo.sql.SqlExecMojo$Transaction.runTransaction(SqlExecMojo.java:1204)
at
org.codehaus.mojo.sql.SqlExecMojo$Transaction.access$100(SqlExecMojo.java:1163)
at org.codehaus.mojo.sql.SqlExecMojo.execute(SqlExecMojo.java:618)
... 19 more
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Wed Apr 25 11:24:36 CEST 2012
[INFO] Final Memory: 19M/167M
[INFO]
------------------------------------------------------------------------
c:\svn\eai\sqlMavenPlugin>
Thanks
Jakub