create proc killspid (@dbname varchar(20))
as
begin
declare @sql nvarchar(500)
declare @spid int
set @sql='declare getspid cursor for
select spid from sysprocesses where dbid=db_id('''+@dbname+''')'
exec (@sql)
open getspid
fetch next from getspid into @spid
while @@fetch_status<>-1
begin
exec('kill '+@spid)
fetch next from getspid into @spid
end
close getspid
deallocate getspid
end
GO

相关文章:

  • 2021-11-11
  • 2022-12-23
  • 2021-11-18
  • 2021-10-20
  • 2022-12-23
猜你喜欢
  • 2021-12-18
  • 2021-11-21
  • 2021-07-28
  • 2021-06-11
相关资源
相似解决方案