Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Reset Incremental Field Number to zero

Author  Topic 

ConfusedAgain
Yak Posting Veteran

82 Posts

Posted - 2010-09-29 : 06:34:44
How do I reset the incremental identity field to zero?

And is it possible to reset it for all fields in all tables in one hit?

This is of value when testing as I clean out all data and want to reset all identity fields.

Thank you very much you very kind and helpful people!

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-09-29 : 07:52:50
quote:
How do I reset the incremental identity field to zero?
DBCC CHECKIDENT, look in Books Online for details.
quote:
And is it possible to reset it for all fields in all tables in one hit?
You can only have one identity column per table.
quote:
This is of value when testing as I clean out all data and want to reset all identity fields.
If you use TRUNCATE TABLE it will automatically reset the identity to the seed value. See Books Online for more details.
Go to Top of Page
   

- Advertisement -