DelphiFAQ Home Search:
General :: Databases :: MS-SQL
Tricks how to deal with Microsoft SQL Server (MS-SQL).

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

How to reset or reseed the IDENTITY column

Question:
How can I reset or reseed the IDENTITY column?

Answer:
See DBCC CHECKIDENT in SQL Server Books Online.

A quick and dirty way to reset the IDENTITY column would be to run TRUNCATE TABLE command on that table. TRUNCATE TABLE will delete all the rows from the table and reset the IDENTITY column. However, you will not be able to run TRUNCATE TABLE on a table referenced by foreign keys.


Generated 12:00:32 on Nov 23, 2017