Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identity Reseed

Status
Not open for further replies.

gwungfu

Technical User
Sep 18, 2005
4
US
Hi Gurus,
Is it possible that a identity column trying to insert a identity value that already exists in the table? What would be the reason to cause this? How I could fix it?

thanks
 
i am not completely sure of your question...how can an identity column try to make a duplicate value...

Are you sure that the value that already exists hasnt been deleted with some triggers or some other procedures??

-DNG
 
I am also not sure how could this happen...but it shows the error message that "trying to insert an duplicate value into unique index column".

By the way...the way of reseeding is

exec sp_chgattribute @table_name, 'identity_burn_max', 0, @max_used_ident
 
If I remember correctly, truncating a table generally resets the identity value back to the start. If that happened, you would probably not notice this as a problem. More likely someone has used IDENTITY_INSERT to manually enter values for your identity column. You should be able to use DBCC CHECKIDENT(tablename) to reset the identity value, but test on a test machine first, as I do not have a Sybase manual handy to check that with.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top