Have you ever really needed to drop a database and you couldn’t? You’ve tried using the management tools, but you forgot you can’t drop a database when you’re in it, or you’re just fighting a process that just won’t seem to die?
Fear not – the following script will do the job. Just replace DatabaseName with the name of the database you want to go away. Before you use it, make sure that the process that isn't going away is something you know about - don't use it blindly.
NOTE: This really works, so really make sure you really really want to drop the database. You have really been warned!
USE DatabaseName; GO ALTER DATABASE DatabaseName SET SINLGE_USER
WITH ROLLBACK IMMEDIATE;GO ALTER DATABASE DatabaseName
SET OFFLINE;GO USE master;GO DROP DATABASE DatabaseName; GO
PingBack from http://www.artofbam.com/wordpress/?p=5470