To reset the identity seed after deleting records in SQL Server, use the DBCC CHECKIDENT command. This command resets the identity value to the specified seed or the current maximum value in the table. Here’s an example:
DELETE FROM your_table;
— Reset the identity seed
DBCC CHECKIDENT (‘your_table’, RESEED, 0);
In this example, after deleting records from your_table, the identity seed is reset to 0. If you want the next inserted row to start with a different value, adjust the RESEED parameter accordingly.