The original ID field of the database is an auto-incrementing column. After all the data is deleted, the ID auto-incrementing column is counted from 1.
Method 1:
1. dbcc checkident ('test', reseed, 0)
2. insert into test values (55)
Select * from test
Display result:
Id msum
1 55
Method 2:
SET IDENTITY_Insert
Explicit values can be inserted into the table's ID column.
Syntax:
SET IDENTITY_Insert [database_name. [schema_name].] table {ON | OFF}
Set identity_insert dbo. test on
Test is the table name.
Note: After you use set identity_insert dbo. test on, when you insert into, you must write the fields that need to be inserted into the record, for example:
Insert into test (id, msum) values (1, 55)
Insert into test (id, msum) values (2, 55)
The statement below is incorrectly written:
Insert into test values (55)
Insert into test values (1, 55)