GO statement been treated as a delimiter in single changeset file

In my changeset file I have several SQL statements that end with GO statement, when I run the Liquibase update / deploy it fails with error

Unexpected error running Liquibase: Incorrect syntax near ‘GO’. [Failed SQL: (102)

Using Liquibase with SQL Server

Hi @virender.jain77!

Would you please share the following:

  • The exact command line you are running for liquibase diff command?
  • Share your liquibase.properties file (if you have any, please take out the passwords)
  • exact error output (please make sure to set logLevel=debug).

Thanks,

Ronak

Script File
–liquibase formatted sql

–changeset XXXX:2 context:XXXX endDelimiter:` runOnchange:true splitStatements=false

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Region](
[RegionID] [int] NOT NULL,
[RegionDescription] nchar NOT NULL)

GO
CREATE TABLE [dbo].[Emp](
[EmpID] [int] NOT NULL,
[Empname] nchar NOT NULL)

Properties file
liquibase --driver=“com.microsoft.sqlserver.jdbc.SQLServerDriver” --classpath="//opt//sqljdbc_8.4//enu//mssql-jdbc-8.4.1.jre8.jar" --url=“jdbc:sqlserver://$servername:portremoved;databaseName=$databaseName;integratedSecurity=false;” --changeLogFile="$sql_script" --username=login --password=_pwd --contexts=$ChangeNumber update

I have multiple files and only cases where using GO is creating error if I remove GO statement and define next script in same file as separate changeset then no error reported.

Also how to use below statements if needed it fails due to GO and replacing with a new changeset is really not acceptable from developers perspective.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

This can be marked as closed.

I tried with endDelimiter:GO and it worked as expected when used fresh scripts. Looks during multiple tries this was earlier not working with endDelimiter:GO as well. So all good now. Thanks Ronak for your help.

Hi @virender.jain77
What was the issue?
I am also facing the same issue in Liquibase 4.17.2 version, it is working in Liquibase 4.12 version