dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Beginner
May 27, 2019

Reseed All Autonumber Fields in All Tables

Reseed all Autonumber fields in all tables with the following query:

EXEC sp_MSForEachTable '  
  
   IF OBJECTPROPERTY(object_id(''?''), ''TableHasIdentity'') = 1  
  
   DBCC CHECKIDENT (''?'', RESEED, 0)
Hannes du Preez
 
Thanks for your registration, follow us on our social networks to keep up-to-date