DROP DATABASE (Transact-SQL)

Removes a database and all its associated objects.

Important: Dropping a database is a destructive operation. All data and objects within the database will be permanently deleted. Ensure you have backed up any critical data before proceeding.

Syntax


DROP DATABASE [ database_name ]
[ ; ]
        

Parameters

database_name
Specifies the name of the database to be dropped. The database name must comply with the rules for identifiers.

Permissions

To execute DROP DATABASE, a user must have the CONTROL permission on the database, or have the ALTER ANY DATABASE permission.

Examples

A. Dropping a database

The following example removes the SalesData database:


DROP DATABASE SalesData;
        

Remarks

Note: It is recommended to execute DROP DATABASE when no users are actively using the database to avoid potential errors or data loss.

See Also