I'm getting the following error from a simple SQL tag in the XML file:
Error
liquibase.exception.DatabaseException: Incorrect syntax near 'INT'.
[Failed SQL: (102) begin
DECLARE @MyVariable INT]
Code:
<changeSet author="me" id="poc" runAlways="true" runOnChange="true" >
<sql>
BEGIN
DECLARE @MyVariable INT;
SET @MyVariable = 10;
END;
</sql>
</changeSet>
SQL code block runs on a SQL Server 2019 with no issue.
I removed the semicolon as suggested in one of stackoverflow threads, it didn't help.
I'm getting the following error from a simple SQL tag in the XML file:
Error
liquibase.exception.DatabaseException: Incorrect syntax near 'INT'.
[Failed SQL: (102) begin
DECLARE @MyVariable INT]
Code:
<changeSet author="me" id="poc" runAlways="true" runOnChange="true" >
<sql>
BEGIN
DECLARE @MyVariable INT;
SET @MyVariable = 10;
END;
</sql>
</changeSet>
SQL code block runs on a SQL Server 2019 with no issue.
I removed the semicolon as suggested in one of stackoverflow threads, it didn't help.
Share Improve this question edited Nov 20, 2024 at 18:43 Dale K 27.5k15 gold badges58 silver badges83 bronze badges asked Nov 20, 2024 at 17:35 RickRick 971 silver badge13 bronze badges 2 |1 Answer
Reset to default 1The issue was resolved by adding the attribute splitStatements="true"
to the SQL tag. Thanks to @siggemannen for the helpful tip.
Updated code
<changeSet author="me" id="poc" runAlways="true" runOnChange="true" >
<sql splitStatements="true">
BEGIN
DECLARE @MyVariable INT;
SET @MyVariable = 10;
END;
</sql>
</changeSet>
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742340681a4425563.html
;
which is wrong, probably you didn't configure it properly for sql server specific dialect – siggemannen Commented Nov 20, 2024 at 18:33