Home Reset identity seed after deleting records in SQL Server
Reply: 0

Reset identity seed after deleting records in SQL Server

user711
1#
user711 Published in June 24, 2018, 11:53 pm

I have inserted records into a SQL Server database table. The table had a primary key defined and the auto increment identity seed is set to “Yes”. This is done primarily because in SQL Azure, each table has to have a primary key and identity defined.

But since I have to delete some records from the table, the identity seed for those tables will be disturbed and the index column (which is auto-generated with an increment of 1) will get disturbed.

How can I reset the identity column after I deleted the records so that the column has sequence in ascending numerical order?

The identity column is not used as a foreign key anywhere in database.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.43459 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO