visit the scripts site on this forum. There are lots of scripts to kill connections based on some criteria such as dbid. amend one of them to suit your needs. the filter will be a column in the master.sysprocesses table.
heres one I have used (test it first)
declare @spid int,
@ntuser varchar(15),
@dbName varchar(30),
@message varchar(80),
@statement nvarchar(30)
declare xc cursor
for
select spid, nt_username, sd.name
from sysprocesses sp,
sysdatabases sd
where sp.dbid = sd.dbid
and sd.name in ('Credit','n')
open xc
fetch next from xc into @spid,@ntuser,@dbName
while (@@fetch_status = 0)
begin
set @message = 'killing User ' + convert(varchar(12),@spid) + ' ' + @ntuser + ' in database ' + @dbname
print @message
set @statement = 'kill ' + convert(varchar(12),@spid)
print @statement
exec sp_executesql @statement
fetch next from xc into @spid,@ntuser,@dbName
end
close xc
deallocate xc
---------------------------------------------------------------------