List of running processes
use master
Select * from master.dbo.sysprocesses
where dbid = db_id(‘DBNAME’)
Killing all processes
Use master
Go
Declare @dbname sysname
Set @dbname = ‘DBNAME’
Declare @spid int
Select @spid = min(spid) from master.dbo.sysprocesses
where dbid = db_id(@dbname)
While @spid Is Not Null
Begin
Execute (‘Kill ‘ + @spid)
Select @spid = min(spid) from master.dbo.sysprocesses
where dbid = db_id(@dbname) and spid > @spid
End