Removes objects from the database.
DROP { DBSPACE dbspace-name | { DATATYPE [ IF EXISTS ] | DOMAIN } datatype-name | EVENT [ IF EXISTS ] event-name | INDEX [ IF EXISTS ] [ [ owner].table-name.]index-name | MESSAGE message-number | TABLE [ IF EXISTS ] [ owner.]table-name | VIEW [ IF EXISTS ] [ owner.]view-name | MATERIALIZED VIEW [ IF EXISTS ] [ owner.]view-name | PROCEDURE [ IF EXISTS ] [ owner.]procedure-name | FUNCTION [ IF EXISTS ] [ owner.]function-name }
DROP INDEX is prevented whenever the statement affects a table that is currently being used by another connection.
DROP TABLE is also prevented if the table has an IDENTITY column and IDENTITY_INSERT is set to that table. To drop the table you must clear IDENTITY_INSERT, that is, set IDENTITY_INSERT to ' ' (an empty string), or set to another table name.
A foreign key can have either a nonunique single or a multicolumn HG index. A primary key may have unique single or multicolumn HG indexes. You cannot drop the HG index implicitly created for an existing foreign key, primary key, and unique constraint.
The four initial dbspaces are SYSTEM, IQ_SYSTEM_MAIN, IQ_SYSTEM_TEMP, and IQ_SYSTEM_MSG. You cannot drop these initial dbspaces, but you may drop dbspaces from the IQ main store or catalog store, which may contain multiple dbspaces, as long as at least one dbspace remains with readwrite mode.
You must drop tables in the dbspace before you can drop the dbspace. An error is returned if the dbspace still contains user data; other structures are automatically relocated when the dbspace is dropped. You can drop a dbspace only after you make it read-only.
DROP TABLEis prevented whenever the statement affects a table that is currently being used by another connection.
DROP TABLE Departments
DROP VIEW emp_dept
DROP DBSPACE myDAS
DROP removes the definition of the indicated database structure. If the structure is a dbspace, then all tables with any data in that dbspace must be dropped or relocated prior to dropping the dbspace; other structures are automatically relocated. If the structure is a table, all data in the table is automatically deleted as part of the dropping process. Also, all indexes and keys for the table are dropped by DROP TABLE.
DROP DBSPACE is prevented whenever the statement affects a table that is currently being used by another connection. DROP PROCEDURE is prevented when the procedure is in use by another connection.
DBSPACE clause – Requires the DROP ANY OBJECT system privilege and user must be the only connection to the database.