How to insert a value in a Identity column?

If you are in situation where you must insert a new record in a table and you must use specific value for a identity column then you can use the following statement:

SET IDENTITY_INSERT Name_of_Table ON;
INSERT INTO Name_of_Table  …
SET IDENTITY_INSERT Name_of_Table OFF;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.