--- title: "Delete a Database | Microsoft Docs" description: Learn how to delete a user-defined database in SQL Server Management Studio in SQL Server by using SQL Server Management Studio or Transact-SQL. ms.custom: "" ms.date: "03/14/2017" ms.service: sql ms.reviewer: "" ms.subservice: supportability ms.topic: conceptual helpviewer_keywords: - "database removal [SQL Server], SQL Server Management Studio" - "removing databases" - "deleting databases" - "dropping databases" - "databases [SQL Server], dropping" - "database removal [SQL Server]" ms.assetid: 1fd8c0f5-03e1-449a-af45-b8cacb479d9c author: WilliamDAssafMSFT ms.author: wiassaf monikerRange: "=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current" --- # Delete a Database [!INCLUDE [SQL Server Azure SQL Database Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdb-asdbmi.md)] This topic describes how to delete a user-defined database in [!INCLUDE[ssnoversion](../../includes/ssnoversion-md.md)] by using [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE[tsql](../../includes/tsql-md.md)]. **In This Topic** - **Before you begin:** [Limitations and Restrictions](#Restrictions) [Prerequisites](#Prerequisites) [Recommendations](#Recommendations) [Security](#Security) - **To delete a database, using:** [SQL Server Management Studio](#SSMSProcedure) [Transact-SQL](#TsqlProcedure) - **Follow Up:** [After deleting a database](#FollowUp) ## Before You Begin ### 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)](../../relational-databases/databases/drop-a-database-snapshot-transact-sql.md). - 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. ## Using SQL Server Management Studio #### To delete a database 1. In **Object Explorer**, connect to an instance of the [!INCLUDE[ssDEnoversion](../../includes/ssdenoversion-md.md)], 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**. ## Using Transact-SQL #### To delete a database 1. Connect to the [!INCLUDE[ssDE](../../includes/ssde-md.md)]. 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. ```sql USE master ; GO DROP DATABASE Sales, NewSales ; GO ``` ## Follow Up: After deleting a database 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. ## See Also [CREATE DATABASE (SQL Server Transact-SQL)](../../t-sql/statements/create-database-transact-sql.md) [ALTER DATABASE (Transact-SQL)](../../t-sql/statements/alter-database-transact-sql.md)