July 10, 2007 at 8:27 am
Below is our project scenario:
DBCC CHECKIDENT (Claim_GC_1136_1zzz, RESEED,-2147483648)
I am not getting any error message on executing the statement. I get something of this sort which seems to be fine.
Checking identity information: current identity value '11', current column value '-999999'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
On strange behavior I could notice is:
We checked the table immediate next day and there was no trace of what we did the previous day. Both the new identity value and newly inserted rows got disappeared! But I should say that it doesn’t happen always. Rarely it is getting reset. Otherwise, the reseed which I executed two weeks back seems to be fine so far without any problems.
I wanted to know how reliable this solution is. Am I missing something in the way I execute the command? Is there any chance of some database process resetting the seed automatically in order to maintain the table integrity?
July 10, 2007 at 9:31 am
Since you are reseeding to a value lower than the maximum value in the table, any future DBCC CheckIdent with the reseed option will automatically reset the current seed value to the maximum it finds in the table. That could be what happened in the instance where it appears your work disappeared.
I've never personally tried to reset to a lower value with the intention of starting the sequence over at that value. I would think this would potentially run into "duplicate" values at some point as it approaches the original first value.
Other than all the work involved it might be better to simply change the data type from integer to numeric(x,x)? I generally use numeric(10,0) which gives me a range up to 10 billion. Of course in a production system this may not be an viable solution especially if it is the PK column of the table and hundreds of other tables reference it. Plus any applications that reference the column might throw errors because the data type is no longer what is expected. It can be done but it is a lot of work.
James.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply