sqlserver drop database currently in use

por | 30 octubre, 2020
USE master;
GO
ALTER DATABASE Test 
SET SINGLE_USER 
WITH ROLLBACK IMMEDIATE;
GO
DROP DATABASE Test;
GO

#LIST DATABASES
SELECT name, database_id, create_date FROM sys.databases ;  
GO