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.

posted on 2011-06-13 17:17  水瓶的坚持  阅读(244)  评论(0编辑  收藏  举报

导航