>

DROP Statement

Description

Deletes an existing table from a database or deletes an existing index from a table.

Note

The Microsoft Jet database engine doesn't support the use of DROP, or any of the data definition language (DDL) statements, with non-Jet databases. Use the data access object Create methods instead.

Syntax

DROP {TABLE table | INDEX index ON table}

The DROP statement has these parts.

Part

Description

table

The name of the table to be deleted or the table from which an index is to be deleted.

index

The name of the index to be deleted from table.


Remarks

You must close the table before you can delete it or remove an index from it.

You can also use ALTER TABLE to delete an index from a table.

You can use CREATE TABLE to create a table and CREATE INDEX or ALTER TABLE to create an index. To modify a table, use ALTER TABLE.

See Also

ALTER TABLE Statement, CONSTRAINT Clause, CREATE INDEX Statement, CREATE TABLE Statement.

Example

The following examples assume the existence of a hypothetical MyIndex index and a hypothetical Trainees table. Note that these objects do not actually exist in the Northwind database.

This example deletes the index MyIndex from the Employees table.


DROP INDEX MyIndex ON Employees;
This example deletes the Trainees table from the database.


DROP TABLE [Trainees];