How to Truncate all the Tables in a Microsoft SQL Database

You can truncate all the tables in a database with the next easy-to-use query:

use [database]
/* where 'database' is the database you want to truncate the tables from */

EXEC sp_MSForEachTable 'TRUNCATE TABLE ?'

Categories

Archive