Prerequisite – Introduction of MS SQL Server and Create Database in MS SQL Server
System databases can’t be deleted, only user databases could be deleted. Data and log files will automatically be deleted from disk with database deletion.
To delete a database, the below methods could be used –
- SQL Server Management Studio.
- Transact-SQL.
These are explained as following below.
1. Using SQL Server Management Studio :
To delete a database, connect to an instance of the SQL Server, and then expand that instance.
Expand Databases, select the database which need to be deleted.
Right-click the database which need to be deleted, and then click Delete.
Check delete backup and restore history or close existing connections if required and then click OK.
2. Using Transact-SQL :
To execute DROP DATABASE statement a user must have CONTROL permission on the database.
- To delete a database :
USE master ; GO DROP DATABASE Databasename; GO
- To delete multiple databases :
USE master ; GO DROP DATABASE database1, database2, ...; GO
Example :
Let us assume we have created a database “Geekstest” which is no longer required, to delete database :
USE master ; GO DROP DATABASE Geekstest; GO
Recommended Posts:
- Create Database in MS SQL Server
- Check whether a Table exists in SQL Server database or not
- Performing Database Operations in Java | SQL CREATE, INSERT, UPDATE, DELETE and SELECT
- Delete statement in MS SQL Server
- Delete Action in MS SQL Server
- Delete Duplicates in MS SQL Server
- Difference between Structured Query Language (SQL) and Transact-SQL (T-SQL)
- SQL Trigger | Student Database
- SQL Trigger | Book Management Database
- SQL queries on FILM Database
- SQL Server Mathematical functions (SQRT, PI, SQUARE, ROUND, CEILING & FLOOR)
- SQL Server Identity
- SQL SERVER | Conditional Statements
- SQL Server | STUFF() Function
- SQL Server | SERVERPROPERTY()
- Mean and Mode in SQL Server
- Allow only alphabets in column in SQL Server
- SQL SERVER | IN Condition
- Reverse Statement Word by Word in SQL server
- Copy tables between databases in SQL Server using Import-and-Export Wizard
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

