T-SQL » Statements » DROP

Syntax:
DROP { TABLE table | INDEX table.index }
table
Indicates the name of the table to be dropped, or the table from which the index is to be dropped.
index
Specifies the name of the index that is to be dropped.

The DROP statement can be used to DROP an entire table from a database, or an index from a table.

Much like a DELETE, once a DROP TABLE takes place, it is permanent. All data, table structure and properties cannot be recovered!

Examples

Code:
DROP INDEX Names.UniqueValues;
Output:
The command(s) completed successfully.
Explanation:

Here, the DROP statement is being used to remove an existing index from a table.

Language(s): MS SQL Server
Code:
DROP TABLE Names;
Output:
The command(s) completed successfully.
Explanation:

This example shows how the DROP statement can also be used to delete an entire table from a database.

You must close a table before you use the DROP statement.

Language(s): MS SQL Server

See Also: