Hi This post describes how to delete a user-defined database in SQL Server Management Studio in SQL Server by using SQL Server Management Studio or Transact-SQL.
Using SQL Server Management Studio
To delete a 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 click Delete.
- Confirm the correct database is selected, and then click OK.
Using Transact-SQL
To delete a database
-
Connect to the Database Engine.
-
From the Standard bar, click New Query.
-
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
If you are Receive Below Error Message
Msg 3702, Level 16, State 3, Line 2
Cannot drop database “DataBaseName” because it is currently in use.
Cannot drop database “DataBaseName” because it is currently in use.
Close SQL Server Management Studio completely. Open it again and connect
as normal. Now you will be able to drop the database with
Conclusion
If you want to drop the database use master database first and then drop the database.
If you want to drop the database use master database first and then drop the database.
Thanks
R.karthikeyan
No comments:
Post a Comment