Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > TRUNCATE (XPS) >

When You Might Use the TRUNCATE Statement

TRUNCATE performs similar operations to those that you can perform with the DELETE statement or with a combination of DROP TABLE and CREATE TABLE.

Using TRUNCATE can be faster than removing all rows from a table with the DELETE statement, because it does not activate any DELETE triggers. In addition, when you use TRUNCATE, the database server creates one log entry for the entire TRUNCATE statement, rather than one for each deleted row.

You might also use this statement instead of dropping a table and then re-creating it. When you drop and re-create a table, you must re-grant any access privileges that you want to preserve on the table. In addition, you must re-create any indexes, constraints, and triggers that were defined on the table. The TRUNCATE statement leaves these database objects and privileges intact.

Related Information

Related statements: DELETE and DROP TABLE

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]