Delete single user mode SQL server DB
1. Use TSQL below to find all the database sesions connected to this database.
select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame
from sysprocesses p inner join sysdatabases d on p.dbid = d.dbid
where d.name = 'TestDB_1'
go
2. Kill the particular session(s) with the 'kill’ command.
kill 51
3. Delte the DB.