Prasanna Kumar J Prasanna Kumar J - 1 year ago 83
SQL Question

How to reset autoincrement id of all tables in a database using SQL Server 2008?

I use the command

DBCC checkident ('tablename', reseed, 200000000);

but I have over 150 tables...

Answer Source

You can use undocumented feature sp_MSforeachtable

EXECUTE sp_MSforeachtable 'DBCC checkident ([?], reseed, 200000000)';
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download