Some days you need to clone complete databases, clear out all the
current data and reseed the indexes before making use of it. If you're
having one of those days, the script below will make short work of the
EXEC sp_MSForEachTable 'DISABLE TRIGGER ALL ON ?'
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'DELETE FROM ?'
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'DBCC CHECKIDENT ([?], RESEED, 0)'
EXEC sp_MSForEachTable 'ENABLE TRIGGER ALL ON ?'
Page rendered at Tuesday, 19 June 2018 23:53:43 (South Africa Standard Time, UTC+02:00)
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in any way.