Wednesday, November 6, 2013

How to fix "Cannot insert duplicate key in object . The duplicate key value is" problem while insert a new record in SQL Server?

First all, Run:
dbcc checkident([tablename],noreseed)
to check the latest id

Then run
DBCC CHECKIDENT ([tablename], reseed, latest id)
to correct latest id

No comments:

Post a Comment