Not able to Delete my Database in SQL Server

Error:
Drop failed for Database 'xxx'. (Microsoft.SqlServer.Smo) An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) Cannot drop database "xxx" because it is currently in use. (Microsoft SQL Server, Error: 3702)

Solution:
There are times when you are working with SQL Server and you attempt to Drop a Database from the SQL Server Management Studio and it throws an Error as shown above stating that the database cannot be dropped because it is currently in use. (Refer to Screenshot below) If you come across this situation, it’s pretty simple to resolve it. You just need to check the option “Close existing connections” at the bottom of the Delete Object window and click on OK that should take care of it. (Refer to Screenshot below).

my image

Tags: