Friday, December 24, 2010

Drop failed for database. Currently in use. Error 3702

Hi All,

Yesterday while working on DNN I needed to restore my website to a previous state. So I thought to drop my current working database and restore a backup copy.

I use MSSQL SERVER 2005. While dropping my working database I got error as below

Drop failed for database {database name}

cannot drop database because it is currently in use. Error 3702



To resolve this problem I googled a bit and then found below as a solution. This worked as a magic to my problem.

USE Master;
GO

ALTER DATABASE {database name} SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO

DROP DATABASE {database name};
GO



Hope it helps you guys also.

About Me

My photo
Delhi, India
Fun, music, travel and nature loving, always smiling, computer addict!!