Friday, July 1, 2011

TRUNCATE all tables in a database

Use the stored procedure sp_MSForEachTable

EXEC sp_MSForEachTable 'TRUNCATE TABLE ?'

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 ?'


1 comment:

  1. A CNC machine store is a spot or a site the place CNC machining or other subtractive manufacturing takes place. It could be be} a large standalone store or a small part of a large manufacturing unit building. Manufacturers can solely meet these calls for by investing in an efficient CNC machine store. Maintaining an built-in workflow system in your human personnel and equipment is essential for the enterprise. Furthermore, have the ability to|you possibly Portable Washers can} present simplified documentation with directions on operating the equipment minimize back} errors.

    ReplyDelete