Removes one or more databases from SQL Server.
DROP DATABASE database_name [, database_name...]
where
Removing a database deletes the database and all its objects, frees its storage allocation, and erases references to it in the master database. A database that has been dropped can only be re-created from database backups. You cannot drop a database that is in use (open for reading or writing by any user).
In earlier releases, the DROP DATABASE statement would not work on damaged databases. In SQL Server 6.0, the DROP DATABASE statement works on databases marked suspect, offline, or not recovered. To drop a database in recovery (sysdatabases..status = 128), use the sp_dbremove system stored procedure.
After any changes are made to the master database, use the DUMP DATABASE statement to back up the master database.
DROP DATABASE permission defaults to the database owner and cannot be transferred. The database owner must be in the master database to use DROP DATABASE.
This example removes all references for the publishing database from the system tables.
DROP DATABASE publishing
This example removes all references for each of the listed databases from the system tables.
DROP DATABASE pubs, newpubs
ALTER DATABASE | sp_helpdb |
CREATE DATABASE | sp_renamedb |
sp_dbremove | USE |