Is it possible to specify more than one stored procedure within one changeset if using MS SQL Server? If so, how? I have tried multiple variations, but keep getting errors. Here is a small snippet:
--liquibase formatted sql
--changeset myname:liquibase_test.1
CREATE TABLE TestTable
(
id INT,
extra FLOAT
);
--changeset myname:liquibase_test.2 stripComments:false splitStatements:false endDelimiter:GO dbms:mssql
CREATE PROCEDURE TEST_PROC
AS
BEGIN
SELECT * FROM TestTable;
END
GO
CREATE PROCEDURE TEST_PROC_2
AS
BEGIN
SELECT * FROM TestTable;
END
GO
This gives the following error:
Liquibase Community 3.8.7 by Datical
Unexpected error running Liquibase: Incorrect syntax near 'GO'. [Failed SQL: (102) CREATE PROCEDURE TEST_PROC
AS
BEGIN
SELECT * FROM TestTable;
END
GO
CREATE PROCEDURE TEST_PROC_2
AS
BEGIN
SELECT * FROM TestTable;
END]
For more information, please use the --logLevel flag
Here is some call stack information when running with --logLevel=all
:
CREATE PROCEDURE TEST_PROC_2
AS
BEGIN
SELECT * FROM TestTable;
END]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:646)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:83)
at liquibase.Liquibase.update(Liquibase.java:202)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.integration.commandline.Main.doMigration(Main.java:1649)
at liquibase.integration.commandline.Main.run(Main.java:303)
at liquibase.integration.commandline.Main.main(Main.java:163)
Caused by: liquibase.exception.DatabaseException: Incorrect syntax near 'GO'. [Failed SQL: (102) CREATE PROCEDURE TEST_PROC
AS
BEGIN
SELECT * FROM TestTable;
END
GO
CREATE PROCEDURE TEST_PROC_2
AS
BEGIN
SELECT * FROM TestTable;
END]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:402)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:59)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:131)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1276)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1258)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:609)
... 7 common frames omitted
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 'GO'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1624)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:868)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:768)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2979)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:744)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:398)
... 12 common frames omitted