Dropping a SQL Server database in a production, staging, or active development environment frequently triggers errors stating the database is currently in use. This happens because background threads, application pools, ORMs, or other developers are actively connected to the target database.
This article covers the two primary T-SQL methods used to force-disconnect users and drop a database: the SINGLE_USER rollback method and the OFFLINE termination method. We will cover both methods in this article.