October 29, 2007 at 9:23 am
Hi! can anyone help me, how to reset the identity value to zero...coz i have a Table(MyTable) with identity field Id_Counter Numeric Precision(3). The number of records already exceeded to 999...when im trying to insert another record an error occured..."Arithmetic overflow error converting IDENTITY to data type numeric." & "Arithmetic overflow occurred." I've tried to delete all the records in (MyTable) but still the error are the same.
October 29, 2007 at 9:29 am
DBCC CHECKIDENT ('dbo.mytable', RESEED, 1)
Regards,
Andras
October 29, 2007 at 9:40 am
Just a further note, do make sure that you reseed to the current max value in the table. Otherwise, if you do not have a unique constraint, you may easily end up with duplicate values.
Regards,
Andras
October 29, 2007 at 9:45 am
..Which you can achieve by NOT specifying the reseed value.
In other words -
DBCC CHECKIDENT ('dbo.mytable', RESEED,1) --first, reset to 1
DBCC CHECKIDENT ('dbo.mytable', RESEED) --then, reset to max of table
would reseed to the maximum of the table IF the amount is less than the highest assigned identity. (so - you need to run BOTH commands above to achieve what you want.)
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
October 29, 2007 at 10:04 am
Thank 🙂 you for the quick reply.
Best Regards,
Ed
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply