Friday, March 26, 2010

SQL Server - Drop/Truncate all Tables from a Database

Found this nice SP call to execute a statement for each table:

EXEC sp_MSforeachtable @command1 = "DELETE FROM ?"

EXEC sp_MSforeachtable @command1 = "TRUNCATE TABLE ?"

No comments: