Icon EMPTY TABLE

Empties a base table by truncation.

Syntax
EMPTY TABLE <TableName>
[IGNORE CONSTRAINTS]

Usage
Use this statement to empty a base table so that all rows are physically removed from the table. When all rows are normally deleted from a table using the DELETE statement, the physical row space is marked for re-use, and the physical table files where the rows, indexes, and BLOBs are stored does not decrease in size. Emptying a table also physically truncates the table file space so that the table files appear as if they were newly-created.

The IGNORE CONSTRAINT clause is used to bypass any constraint checks, which makes the EMPTY TABLE operation faster, but at the risk of violating foreign-key constraints, if any are present. See below for more information on the elevated privileges required to use this clause.

Examples
-- The following example empties
-- the Customer table, ignoring any
-- defined constraints

EMPTY TABLE Customer
IGNORE CONSTRAINTS

Required Privileges
The current user must be granted the DELETE privilege on the table being emptied. If the IGNORE CONSTRAINTS clause is specified, then the current user must be granted the system-defined Administrators role in order to execute this statement. Please see the User Security topic for more information.

SQL 2003 Standard Deviations
This statement deviates from the SQL 2003 standard in the following ways:

DeviationDetails
ExtensionThis SQL statement is an ElevateDB extension.
Image