MSSQL Cannot drop database because it is currently in use
USE Master ; GO ALTER DATABASE AnnoyingDb SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO -- and finally DROP DATABASE AnnoyingDb ; GO
Older blog migrated here on Feb 2009 (labels in footer). Code is design. Entrepreneurs are artists.