SQL Server is recommended to restore the SQL code of the sequence number of the automatic Number Column
SQL Server is recommended to re-restore the SQL code for the serial number of the auto-numbered Column
SQL server often has the following problems:
After a table uses columns with automatic numbers, tens of thousands of columns have been automatically numbered due to a large amount of data being tested. Now we are using this table, and the test data has been deleted. The legacy problem is that we are entering new data and the number will only be increased, deleted numbers cannot be used. Who knows how to solve this problem?
The truncate command not only clears all data, but also restores the SEED value of IDENTITY to the original value.
Dbcc checkident is more convenient. You can specify the SEED value without deleting data.
1. truncate table tablename
2. dbcc checkident (tablename, reseed, 1)