Friday, July 1, 2011

TRUNCATE all tables in a database

Use the stored procedure sp_MSForEachTable


You can use this stored procedure to execute any sql code for each table in a database. For example, you could use it to get the row count for each table in the database

EXEC sp_MSForEachTable 'SELECT COUNT(*) as ''?'' FROM ?'

No comments:

Post a Comment