Export (0) Print
Expand All
7 out of 16 rated this helpful - Rate this topic

Delete a Database

This topic describes how to delete a user-defined database in SQL Server Management Studio in SQL Server 2012 by using SQL Server Management Studio or Transact-SQL.

Limitations and Restrictions

  • System databases cannot be deleted.

Prerequisites

  • Delete any database snapshots that exist on the database. For more information, see Drop a Database Snapshot (Transact-SQL).

  • If the database is involved in log shipping, remove log shipping.

  • If the database is published for transactional replication, or published or subscribed to merge replication, remove replication from the database.

Recommendations

  • Consider taking a full backup of the database. A deleted database can be re-created only by restoring a backup.

Security

Permissions

To execute DROP DATABASE, at a minimum, a user must have CONTROL permission on the database.

Arrow icon used with Back to Top link [Top]

To delete a database

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.

  2. Expand Databases, right-click the database to delete, and then click Delete.

  3. Confirm the correct database is selected, and then click OK.

Arrow icon used with Back to Top link [Top]

To delete a database

  1. Connect to the Database Engine.

  2. From the Standard bar, click New Query.

  3. Copy and paste the following example into the query window and click Execute. The example removes the Sales and NewSales databases.

USE master ;
GO
DROP DATABASE Sales, NewSales ;
GO

Arrow icon used with Back to Top link [Top]

Back up the master database. If master must be restored, any database that has been deleted since the last backup of master will still have references in the system catalog views and may cause error messages to be raised.

Arrow icon used with Back to Top link [Top]

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.