Dropping an Index

From InterBase

Go Up to Dropping Metadata


To delete an index, use DROP INDEX. An index can only be dropped by its ­creator, the SYSDBA, or a user with root privileges. If an index is in use when the drop is attempted, the drop is postponed until the index is no longer in use. The syntax of DROP INDEX is:

EXEC SQL
DROP INDEX name;

<name> is the name of the index to delete. For example, the following statement drops the index, NEEDX:

EXEC SQL
DROP INDEX NEEDX;
EXEC SQL
COMMIT;

Deletion fails if the index is on a UNIQUE, PRIMARY KEY, or FOREIGN KEY integrity constraint. To drop an index on a UNIQUE, PRIMARY KEY, or ­FOREIGN KEY integrity constraint, first drop the constraints, the constrained columns, or the table.

For more information about DROP INDEX and dropping integrity constraints, see the Data Definition Guide.

Advance To: