0

I am using Liquibase tool for database migration from one database(MSSQL) to other database(MSSQL). I am able to generate change xml file using generateChangeLog command which has create and insert queries. so far its good.

Now when I try to execute update command then it fails with below reason:

liquibase.exception.DatabaseException: Cannot insert explicit value for identity column in table ‘TableName’ when IDENTITY_INSERT is set to OFF.

It works fine if I manually add below tag in change xml file,

SET IDENTITY_INSERT HOSTGROUP ON;

Insert queries here…

SET IDENTITY_INSERT HOSTGROUP OFF;

But I am looking for automated way.

Is there any option in generateChangeLog command to add above tag automatically? Please help.

htshame
  • 6,599
  • 5
  • 36
  • 56
Sohan Badaya
  • 365
  • 4
  • 15

0 Answers0