fix for 'Cannot drop database “MyDatabase” because it is currently in use' error

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 920
To fix the 'currently is in use error while dropping database, the below code snippet will work...


USE MASTER
GO
ALTER DATABASE MyDatabase
SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE MyDBName
GO


NOTE: Do NOT run this in Production environment.....

Comments or Responses

Login to post response