Mar312015

Force Drop a Database From T-SQL

While it's rather easy to force drop a database from SQL Server Management Studio's UI, it's just as easy to script it out:

ALTER DATABASE [YOUR-DATABASE-NAME] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO
USE MASTER
GO
DROP DATABASE [YOUR-DATABASE-NAME]
GO
CREATE DATABASE [YOUR-DATABASE-NAME]
GO