Thread: usp_killusers
View Single Post
  #3 (permalink)  
Old July 1st, 2007, 08:56 AM
ccote_1 ccote_1 is offline
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by dakaratekid
 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

HI, Thanks for your help! But the book should not tell readers something that seems to be not exact. If the usp_killusers exists, it should be available here. But waht you gave me will do the job.

Thanks again!