Thread: usp_killusers
View Single Post
  #2 (permalink)  
Old June 29th, 2007, 11:05 AM
dakaratekid dakaratekid is offline
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can just roll your own:

create proc usp_killusers
@dbname varchar(30)
as
declare @sql varchar(60)
declare kill_cur cursor fast_forward for
select 'kill ' + cast(spid as varchar) from master.dbo.sysprocesses where dbid = db_id(@dbname)

open kill_cur
fetch next from kill_cur into @sql
while @@fetch_status = 0
begin
   exec(@sql)
   fetch next from kill_cur into @sql
end
close kill_cur
deallocate kill_cur
go

hth, dKK