TRUNCATE TABLE statement

Description

Deletes all rows from a table without deleting the table definition.

Syntax

TRUNCATE TABLE [ owner.]table-name

Examples

Example 1

Deletes all rows from the department table:

TRUNCATE TABLE department

Usage

TRUNCATE TABLE is equivalent to a DELETE statement without a WHERE clause, except that each individual row deletion is not entered into the transaction log. After a TRUNCATE TABLE statement, the table structure and all of the indexes continue to exist until you issue a DROP TABLE statement. The column definitions and constraints remain intact, and permissions remain in effect.

The TRUNCATE TABLE statement is entered into the transaction log as a single statement, like data definition statements. Each deleted row is not entered into the transaction log.


Side effects

None.

Standards

Permissions

See also

DELETE statement

Chapter 10, “Transactions and Versioning” in Sybase IQ System Administration Guide