Inserting data from other source to identity column and need to retain the indentity values.

Use below Code

set IDENTITY_INSERT dbo.<tablename> ON

insert Statement ex:


DISP_SUBCATG_ID,PROD_ID,CREATE_TMSP,LAST_UPDATE_TMSP,LAST_DB_USER_NM) values(’20008′,’1003′,NULL,’1162′,’2007-03-20 13:41:00.000′,NULL,’dbo’)

set IDENTITY_INSERT dbo.<tableName> OFF

insert statement must specify the columns to insert

Communities Tagged : Technology
Tagged: Identity Column , insert , SQL Server

Leave a Reply

Your email address will not be published. Required fields are marked *