Events
31 Mar, 23 - 2 Apr, 23
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
This article describes how to delete a user-defined database in SQL Server by using SQL Server Management Studio or Transact-SQL.
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.
Warning
Consider taking a full backup of the database before dropping it. A deleted database can be re-created only by restoring a full backup. For more information, see Quickstart: Backup and restore a SQL Server database on-premises.
To execute DROP DATABASE, at a minimum, a user must have CONTROL permission on the database.
In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.
Expand Databases, right-click the database to delete, and then select Delete.
To confirm you want to delete the database, select Yes.
In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.
Expand Databases, right-click the database to delete, and then select Delete.
Confirm the correct database is selected, and then select OK.
For more information, see DROP DATABASE (Transact-SQL).
Connect to the Database Engine.
From the Standard bar, select New Query.
Copy and paste the following example into the query window and select Execute. This example removes the Sales
and NewSales
databases.
USE master ;
GO
DROP DATABASE Sales, NewSales ;
GO
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.
Events
31 Mar, 23 - 2 Apr, 23
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayTraining
Module
Back up and restore your Azure SQL database - Training
Learn how to protect the data in your Azure SQL database and recover from data loss or corruption with backup and restore.
Certification
Microsoft Certified: Azure Database Administrator Associate - Certifications
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.