This blog encompasses the idea of how to drop a database in SQL Server using the two listed methods :-
- SQL Server Management Studio (SSMS)
- Transact-SQL (T-SQL)
Caution Point: Dropping a database in SQL Server permanently removes the database from the server. You cannot undo this critical operation once executed. It is advisable to have backup of the database before dropping it, in case the need to restore it arises.
Drop Database Using SQL Server Management Studio (SSMS)
Step 1: Connect to SQL Server
To drop a database, firstly connect to SQL Server using SQL Server Management Studio (SSMS). Proceed to the next step after establishing the connection.
Step 2: Select the databases to drop
Go to Object Explorer of SSMS ➡ Expand database folder ➡ From the list of databases, right-click on the database you want to delete ➡ Select “Delete” option.
Step 3: Confirm the action
After selecting the “Delete” option, a confirmation dialog box will appear. Ensure the correct database is selected and click on the “OK” button.
Step 4: Drop the database
The action may take some time to execute depending on the size of the database. Once done, you will receive a message indicating the database has been deleted.
Drop Database Using SQL Transact-SQL (T-SQL)
DROP DATABASE database_name;
Use the above query and replace “database_name” with the name of the database you want to drop and execute.
Verify The Deletion
You can check if the database has been dropped by refreshing the Databases folder in Object Explorer. The deleted database will not appear in the list.
Dropping a database on SQL server is an irreversible action, hence it is important to have a proper backup of the database to avoid any loss of data.
This blog highlights the process of dropping a database involving two methods- SQL Server Management Studio (SSMS) and Transact-SQL (T-SQL). You can follow the guidelines mentioned above to successfully drop a database on SQL server.