truncate table

Description

Removes all rows from a table.

Syntax

truncate table [[database.]owner.]table_name 

Parameters

table_name

is the name of the table to truncate. Specify the database name if the table is in another database, and specify the owner’s name if more than one table of that name exists in the database. The default value for owner is the current user, and the default value for database is the current database.

Examples

Example 1

Removes all data from the authors table:

truncate table authors

Usage

Standards

ANSI SQL – Compliance level: Entry-level compliant.

Permissions

truncate table permission defaults to the table owner and is not transferable. To truncate a system audit table (sysaudits_01, sysaudits_02, sysaudits_03, and so on, through sysaudits_08), you must be a System Security Officer.

See also

Commands create trigger, delete, drop table