Reputation: 3709
The identity specification starts from the last number +1 even I have deleted all rows, it never starts from 1.
Upvotes: 1
Views: 72
Reputation: 498
If you want to start the first number after deleting all items, you need to reset the seed.
https://technet.microsoft.com/en-us/library/ms176057.aspx
DBCC CHECKIDENT ('[Table]', RESEED, 0);
GO
Upvotes: 0
Reputation: 33581
When you delete rows from your table the identity value is not reset. You need to either truncate the table (which will reset the identity) or RESEED the identity.
https://msdn.microsoft.com/en-us/library/ms176057.aspx
Upvotes: 4
Reputation: 4634
The identity spec isn't designed to restart from 1 after you do DELETE operations on a table. You have to TRUNCATE TABLE to reset to 1.
Upvotes: 0