Notes on Reference Citations - Version 2.71, by Dr. Herong Yang
SET IDENTITY_INSERT for table fails
'Listing All Culumns - getColumns()' tutorial was cited in a Liquibase bug report in 2011.
The Listing All Culumns - getColumns() tutorial was cited in a Liquibase bug report in 2011.
Subject: SET IDENTITY_INSERT for table fails when IDENTITY column doesn't exist Date: Aug 31, 2011 Author: Antti Andreimann Source: https://liquibase.jira.com/browse/CONTRIB-14 > The SET IDENTITY_INSERT <tableName> ON is done irrespective of > checking if the insert is being made on a table which has an > IDENTITY column. This results in the exception: > > Table '<tableName>' does not have the identity property. Cannot > perform SET operation > > Thus, a check needs to be performed before appending the statements > whether the table has IDENTITY column or not. That's a nasty bug. It blocks me from initializing database with liquibase because DBCHANGELOGLOCK does not have an identity column. The existence of an identity column should be checked. Either from Java side by looking for the word "identity" in TYPE_NAME http://www.herongyang.com/JDBC/sqljdbc-jar-Column-List.html or with IF ((SELECT OBJECTPROPERTY( OBJECT_ID(N'table_name_here'), 'TableHasIdentity')) = 1) http://stackoverflow.com/questions/87747/how-do-you-determine-what-sql- tables-have-an-identity-column-programatically
Table of Contents