Removes one or more databases from Microsoft® SQL Server™. Removing a database deletes the database and the disk files used by the database.
DROP DATABASE database_name [ ,...n ]
Specifies the name of the database to be removed. Execute sp_helpdb from the master database to see a list of databases.
To use DROP DATABASE, the database context of the connection must be in the master database.
DROP DATABASE removes damaged databases marked as suspect and removes the specified database. Before dropping a database used in replication, first remove replication. Any database published for transactional replication, or published or subscribed to merge replication cannot be dropped. For more information, see Administering and Monitoring Replication. If a database is damaged and replication cannot first be removed, in most cases you still can drop the database by marking it as an offline database.
A dropped database can be re-created only by restoring a backup. You cannot drop a database currently in use (open for reading or writing by any user). When a database is dropped, the master database should be backed up.
System databases (msdb, master, model, tempdb) cannot be dropped.
A database in read-only mode can be dropped.
DROP DATABASE permissions default to the database owner, members of the sysadmin and dbcreator fixed server roles, and are not transferable.
A. Drop a single database
This example removes all references for the publishing database from the system tables.
DROP DATABASE publishing
B. Drop multiple databases
This example removes all references for each of the listed databases from the system tables.
DROP DATABASE pubs, newpubs