Reseeding and Updating the INDENT_CURRENT Value in SQL Server

This code will do the following:

1. Display the current INDENT_CURRENT value for the identity column for the specified table. This value should be the SAME value as the highest value for the column in the table.

2. This SELECT gives you the highest assigned identity value in the table

3. The SQL statement performs the resetting of the IDENT_CURRENT value should it not be correct. The next INSERT to be performed no this table will use this value as a base + the increment value set for the table.

I had a situation in production where the values of both queries #1 and #2 were the same and the error still came up. I ran query #3 incrementing the reseed value +1 of the current top seed value. That fixed the issue.

Views – 1672

Leave a Reply