SQL SERVER – FIX : Error : 3702 Cannot drop database because it is currently in use.

Msg 3702, Level 16, State 3, Line 2
Cannot drop database “DataBaseName” because it is currently in use.

This is a very generic error when DROP Database is command is executed and the database is not dropped. The common mistake user is kept the connection open with this database and trying to drop the database.

The following commands will raise above error:


USE AdventureWorks;
GO
DROP DATABASE AdventureWorks;
GO



Fix/Workaround/Solution:
The following commands will not raise an error and successfully drop the database:

USE Master;
GO
DROP DATABASE AdventureWorks;
GO

If you want to drop the database use master database first and then drop the database.

Reference : Pinal Dave (https://blog.sqlauthority.com)

,
Previous Post
SQL SERVER – 2005 – Dynamic Management Views (DMV) and Dynamic Management Functions (DMF)
Next Post
SQL SERVER – Generic Architecture Image

Related Posts

61 Comments. Leave new

Leave a Reply

Menu