I have a table with a identity column. I need to reset that identity column from zero. What should i do for this.
Here, to reset the Identity column in SQL Server you can use DBCC CHECKIDENT method. Syntax : DBCC CHECKIDENT ('table_name', RESEED, new_value); Note : If we reset the existing records in the table and insert new records, then it will show an error.
Duplicate identity values can occur in a table when inserting identity values or reseeding the identity value.
SQL Server internally manages the values of Identity Columns and does not generate any Duplicate Values.
Use DBCC CHECKIDENT:
DBCC CHECKIDENT(<tablename>, RESEED, 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With