SET IDENTITY_INSERT PRODUCTS ON not working
Posted on 2006-04-22
First I'm a real beginner, so be very basic with me, ok? I deleted a row I needed, and I have been successful in inserting a new row with all the variables. However I would like the id column value to be 384. I understand that I can re-insert the whole row if I SET IDENTITY_INSERT PRODUCTS ON, (where my table name is products), and then insert the row, with the value for id being 384:
Insert into products ("id", "code", "name")
VALUES (' 384', 'CTG', 'Heat and Eat!')
Then I should SET IDENTITY_INSERT PRODUCTS OFF.
However, if I try this, I still get an error:
"Cannot insert explicit value for identity column in table products when IDENTITY_INSERT is set to OFF."
Can anyone help? Thanks!