Cannot drop a database in Azure Data Studio, because it's currently in use Cannot drop a database in Azure Data Studio, because it's currently in use sql-server sql-server

Cannot drop a database in Azure Data Studio, because it's currently in use


Someone else is connected, so you need to set it to SINGLE_USER. This will terminate any existing connections, so that the database can be dropped.

USE master;GOALTER DATABASE zap SET SINGLE_USER WITH ROLLBACK IMMEDIATE;GODROP DATABASE zap;GO


You can try the following:

use master;goALTER DATABASE zap SET SINGLE_USER WITH ROLLBACK IMMEDIATE;Go

then drop database.

There is no need to find session which is connected to your database. it can be as simple as an object explorer open in another window. kill the session with the command above and then drop the database.

https://docs.microsoft.com/en-us/sql/relational-databases/databases/set-a-database-to-single-user-mode?view=sql-server-ver15