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

 About This Book

 Reference Citations in 2017

 Reference Citations in 2016

 Reference Citations in 2015

 Reference Citations in 2014

 Reference Citations in 2013

 Reference Citations in 2012

Reference Citations in 2011

 Simplified Chinese Unicode table

 How to Edit a Mobile Registry With Commander

 OpenSSL in Ruby

 Utilisation de la JVisualVM en remote via jstatd

 OpenOffice.org Newsletter - April 2011

 AES Encryption / Decryption with Java 1.5 and ActionScript as3crypto

 problem in insert into database

 2X Gateway SSL

 Creating Installer

 Implement statement batch for Connector C++

 Twitter OAuth Library/HUD

 How to connect Oracle data base

 regexParser.cpp

 gloria.tv downloader

SET IDENTITY_INSERT for table fails

 Winsock TCP buffering behaviour

 Passing Array in Function

 Reference Citations in 2010

 Reference Citations in 2009

 Reference Citations in 2008

 Reference Citations in 2007

 Reference Citations in 2006

 Reference Citations in 2005

 Reference Citations in 2004

 Reference Citations in 2003

 PDF Printing Version