An explicit value for the identity column in table '' can only be specified when a column list is used and IDENTITY_INSERT is ON

by Administrator 23. October 2009 20:06

Easy one this, if you're trying to insert rows with specific values to go into an identity column (e.g. when transferring data from one database to another) you need to use the following kind of statement

SET IDENTITY_INSERT tablename ON

 

INSERT INTO tablename (column1, column2)

SELECT column1, column2 FROM table2

 

SET IDENTITY_INSERT tablename OFF



Buy Me a Beer ?

If you've found this site useful, you could help support its running costs by either checking out the adverts on the page if you find anything that interests you - or by making a small donation