SQL syntax set identity_insert tender ON - doesn't work

Mar 03, 2009 0 Replies

Trying to fix for a client the known issue with the tenders and the touchscreen, where selecting a tender on the touchscreen does not take you to the corresponding tender on the tender screen.



I have a copy of the KB that indicates you first need to run 'set identity_insert tender ON' before you can insert values back into the tender table



problem is i keep getting an error mssg indicating that "Cannot insert explicit value for identity column in table 'Tender' when IDENTITY_INSERT is set to OFF." - - in other words, it appears to reset back to OFF right after I run the "set to ON" query



I am doing this in store ops administrator. Tried it on SQL mgmt studio and it also fails with the same error mssg



But it works when I run both on the same query: set identity_insert tender ON go insert into tender (id, description, additionaldetailtype, displayorder, code) values (1, 'Cash', 1, 1, 'CS') - - this succeeds....



Just wanted to run this through some more experienced SQL users - is my syntax correct? Am I jacking up the table schema with my syntax? Does it re-set to OFF after I run this, or do I need to manually set to OFF?



I appreciate any feedback on this - thanks.



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required