I was wondering what you would use to scrub a database of all test data (leaving the structure intact) prior to going into production?
I use something like:
-- disable referential integrity
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
GO
EXEC sp_MSForEachTable '
IF OBJECTPROPERTY(object_id(''?''), ''TableHasForeignRef'') = 1
DELETE FROM ?'
DBCC CHECKIDENT (''?'', RESEED, 0)
GO
-- enable referential integrity again
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
GO
Which I think I picked up on the net somewhere, however, it doesn't always seem to reseed everything back to zero.