DROP TABLE statement

Use the DROP TABLE statement to remove a table with its associated indexes and data. This statement has some extensions compared to the ANSI/ISO standard for SQL.

Syntax


1  DROP TABLE? IF EXISTS?   owner  .
1 table
1 synonym
1! CASCADE
1? RESTRICT
Element Description Restrictions Syntax
owner Name of table owner Must own the table Owner name
synonym Local synonym for a table that is to be dropped The synonym and its table must exist, and USETABLENAME must not be set to 1 Identifier
table Name of a table to drop Must be registered in the systables system catalog table of the local database Identifier

Usage

You must be the owner of the table or have the DBA privilege to use the DROP TABLE statement.

If you include the optional IF EXISTS keywords, the database server takes no action (rather than sending an exception to the application) if no table of the specified name is registered in the current database.

If the DROP TABLE is used with a synonym name, both the synonym and the table identified by the synonym are dropped along with any other synonyms that reference the same table.

You can prevent users from specifying a synonym in DROP TABLE statements by setting the USETABLENAME environment variable. If USETABLENAME is set, an error results if any user specifies a synonym name in a DROP TABLE statement.

If you issue a DROP TABLE statement, DB-Access does not prompt you to verify that you want to delete an entire table.