Set AutoIncrement initial value for Sql Server Primary Key column
DBCC checkident ('tableName', reseed, 1000);
Actually, this code has several purposes.
- It gives Identity information only when the table name is given.
- When ‘reseed‘ is added, if the table has a problem with identity, it helps to fix it, for example, it can be used in cases of double id throwing.
- The 1000 at the end assigns the current identity number depending on your request.
When the above code is run, the identity value will be set as 1001 for the new record of the table named ‘tableName’.