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