Contents IndexSYSTEM statement UNION operation

User's Guide
   Part VI. SQL Anywhere Reference
     Chapter 43. Watcom-SQL Statements
      TRUNCATE TABLE statement

Function

To delete all rows from a table, without deleting the table definition.

Syntax

     TRUNCATE TABLE [ owner.]table-name

Usage

Anywhere.

Permissions

Must be the table owner or have DBA authority.

Side effects

Delete triggers are not fired by the TRUNCATE TABLE statement.

See also

Description

The TRUNCATE TABLE statement deletes all rows from a table. It is equivalent to a DELETE statement without a WHERE clause, except that no triggers are fired as a result of the TRUNCATE TABLE statement and 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 triggers 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.

Example

Delete all rows from the department table.

     TRUNCATE TABLE department

Contents IndexSYSTEM statement UNION operation