DROP DATABASE

Remove a database from the server.

Syntax
      DROP DATABASE database_name  [ ,...n ] [;]

      DROP DATABASE database_snapshot_name [ ,...n ] [;]

Key:
    database_name
           Name of the database. To display a list of databases, use the sys.databases catalog view.

   database_snapshot_name
           Name of a database snapshot to be removed. 

The database context of the session runnning this command cannot be the same as the database about to be dropped.

You cannot drop a database if any users are currently reading or writing data, see ALTER DATABASE SINGLE_USER.

Before dropping the database: make a backup, drop any database snapshots and, if the database is involved in log shipping, remove log shipping.

Requires CONTROL permission on the database.

Example

DROP DATABASE MyDatabase;

"I would rather train someone and lose them, then not train them and keep them" ~ Zig Ziglar

Related commands:

ALTER DATABASE
CREATE DATABASE
sys.databases

Equivalent Oracle command:

None, delete the datafiles and stop the background processes (OraTab/Services)


© Copyright SS64.com 1999-2014
Some rights reserved