hi friends
I have to update the primary key. When i am inserting in a data grid it newly inserting a record. I am unable to. What is the reason, pls help me.
hi friends
I have to update the primary key. When i am inserting in a data grid it newly inserting a record. I am unable to. What is the reason, pls help me.
Have you tried
SET IDENTITY_INSERT table ON
[Insert records]
SET IDENTITY_INSERT table OFF
???
If your primary key is subject to change than it may not have been the best candidate for a primary key. All things being equal, you do not want to edit the primary key.
If there is a need to insert a specific value into the primary key (data migration for example), you can turn on IDENTITY_INSERT, do what you need to do, and then turn it back off.
This is rather dangerous if you're not careful and can cause collisions if not carefully controlled.