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.
DROP DATABASE [ database_name ]
[ ; ]
database_nameTo execute DROP DATABASE, a user must have the CONTROL permission on the database, or have the ALTER ANY DATABASE permission.
The following example removes the SalesData database:
DROP DATABASE SalesData;
DROP DATABASE can only be used to drop user-defined databases. You cannot drop system databases like master, model, msdb, or tempdb.DROP DATABASE statement will fail. You might need to terminate existing connections before dropping the database.Note: It is recommended to execute DROP DATABASE when no users are actively using the database to avoid potential errors or data loss.