Monthly Archives: April 2012

cannot drop database because it is currently in use


1) While trying to drop the database dont use the same database name.

USE Master;
GO


DROP DATABASE TestDB;
GO

2) But again you are getting the same error, then completly close SQL Server Management Studio . Open it again and connect. Now try to run the below script

USE Master;
GO


DROP DATABASE TestDB;
GO

3) Still if u get the error, then find sessions of the database that you are trying to drop

EXEC sp_who2
--Run kill SPID for each process that is using the database to be dropped.
kill <SPID> -- Kill 57