DROP TABLE statement
Use the DROP TABLE statement to remove a table with its associated indexes and data. This statement is an extension to the ANSI/ISO standard for SQL.
Syntax
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 DROP TABLE statement 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 attempts to specify DROP TABLE synonym.
You cannot drop a system catalog table.
If you issue a DROP TABLE statement, DB-Access does not prompt you to verify that you want to delete an entire table.