Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: NT
Expertise: Beginner
Dec 7, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Primary Key Identity

I have installed Service Pack 4 for SQL Server and Service Pack 4 for NT. I still receive this same error. Your Q&A suggests that this problem was fixed in one of the service packs. I suppose the only fix is a scheduled DBCC check on each table in the database?

An article (Q163446)in the Microsoft Knowledge Base discusses a problem with the @@identity global variable. Basically, the value can change if other people insert into other. This could cause the wrong values to be inserted into a table.

If the problem is severe enough, consider the cost/benefit side to implementing your own identity scheme by saving the last-used value in a table of your own and bumping up the value after every insert. Besides the cost of changing the tables and codes, you might also run into locking conflicts on the additional table.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date