exec sp_who SELECT request_session_id FROM sys.dm_tran_locks WHERE resource_database_id = DB_ID('DatabaseName') kill [spid] USE Master ALTER DATABASE [DatabaseName] SET MULTI_USER |
exec sp_who SELECT request_session_id FROM sys.dm_tran_locks WHERE resource_database_id = DB_ID('DatabaseName') kill [spid] USE Master ALTER DATABASE [DatabaseName] SET MULTI_USER |