sqlFile syntax error near "GO"

Hi

 

I am trying to run a liquibase deploy and am getting and error if I place a GO in my SQL file. If I use a ; it seems to be happier however I then get an error stating that ALTER must be the first statement in the batch. If I tell it to split the statements then my initial check to create the function before running the ALTER, fails due to the (I guess) the create being outside of the scope of the ALTER transaction.

 

I call the SQL file using the following command:

 

My SQL file looks like this:

IF OBJECT_ID(N’fn_getFinalisedDate’) is null

      EXEC sp_ExecuteSQL N’CREATE FUNCTION fn_getFinalisedDate() returns char(35) as begin RETURN ‘‘Function fn_getFinalisedDate() is incomplete’’ end’

GO

 ALTER FUNCTION [dbo].[fn_getFinalisedDate] (@transactionref int)   
 RETURNS datetime   

 

If I generate a full SQL Script and copy paste it into my Query tool, the script runs 100%.

 

Thanks

Jonathan Russell

Senior SQL DBA

I forgot to mention, I am using Liquibase version 2.0.1

Any resolution for this problem?

 

I am also getting the same error and I am not able to proceed…

You have missing the endDelimiter attribute. 

  1.       <sqlFile splitStatements="true" endDelimiter="GO" stripComments="false">...

Note value is case sensitive.