Insert into identity column
Hello :) I'm developping an application, and i have an indentity column in my database. At some point i need to insert something in the identity column..is there a way to do this? because i get an error. thanks!
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Iftikar HussainRank #423 · 5.9K reputationPosted Jul 1, 2013, 7:42 AM EDT
You can do this like below
SET INDENTITY INSERT ON
insert into table(EmpId) values(101)
SET INDENTITY INSERT OFF
Regards,
Iftikar
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 1, 2013, 8:18 AM EDT
http://blog.sqlauthority.com/2009/05/03/sql-server-add-or-remove-identity-property-on-column/
http://www.sqlteam.com/article/how-to-insert-values-into-an-identity-column-in-sql-server
Violeta Popa132 reputationPosted Jul 1, 2013, 11:00 AM EDT