USE [master]

GO
DECLARE @kill2 varchar(8000) = '';  
SELECT @kill2 = @kill2 + 'kill ' + CONVERT(varchar(5), session_id) + ';'  
FROM sys.dm_exec_sessions
WHERE database_id  = db_id('pacsdbname')

EXEC(@kill2);
GO

/****** Object:  Database [pacs]    Script Date: 7/3/2019 12:01:00 PM ******/
DROP DATABASE [pacsdbname]
GO

GO

/****** Object:  Login [pacs]    Script Date: 7/3/2019 1:20:21 PM ******/
DROP LOGIN [user_pacsdbname]
GO

