Prasanna Kumar J Prasanna Kumar J - 4 months ago 18
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...


You can use undocumented feature sp_MSforeachtable

EXECUTE sp_MSforeachtable 'DBCC checkident ([?], reseed, 200000000)';