Deleting All Rows Using TRUNCATE TABLE

Accessing and Changing Relational Data

Accessing and Changing Relational Data

Deleting All Rows Using TRUNCATE TABLE

The TRUNCATE TABLE statement is a fast, nonlogged method of deleting all rows in a table. It is almost always faster than a DELETE statement with no conditions because DELETE logs each row deletion, and TRUNCATE TABLE logs only the deallocation of whole data pages. TRUNCATE TABLE immediately frees all the space occupied by that table's data and indexes. The distribution pages for all indexes are also freed.

As with DELETE, the definition of a table emptied using TRUNCATE TABLE remains in the database, along with its indexes and other associated objects. The DROP TABLE statement must be used to drop the definition of the table.

To delete all rows in a table using TRUNCATE TABLE

Transact-SQL

See Also

DROP TABLE