June 1, 2008 at 6:33 am
Hi,
Can anyone tell me how we can kill similar processes at a time in Taskmanger from QA....
Like..If i have 5 process running and all of processnames like test.exe,tester.exe,tempo.exe,terminal.exe...
Now how i can kill all process having starting letter 'te' and any extension....
Thanks
June 1, 2008 at 2:53 pm
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@spidint,
@ntuservarchar(15),
@dbNamevarchar(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
---------------------------------------------------------------------
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply