USE [master]
GO
/****** Object:  StoredProcedure [dbo].[p_killspid]    Script Date: 07/29/2010 10:58:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create   proc   [dbo].[p_killspid] 
@dbname   varchar(200)     
as     
declare   @sql     nvarchar(500)     
declare   @spid   nvarchar(20) 
declare   #tb   cursor   for 
select   spid=cast(spid   as   varchar(20))   from   master..sysprocesses   where   dbid=db_id(@dbname) 
open   #tb 
fetch   next   from   #tb   into   @spid 
while   @@fetch_status=0 
begin     
exec( 'kill   '+@spid) 
fetch   next   from   #tb   into   @spid 
end     
close   #tb 
deallocate   #tb  
go

 

相关文章:

  • 2022-12-23
  • 2021-08-18
  • 2022-12-23
  • 2021-08-02
  • 2021-12-19
  • 2021-07-09
  • 2021-06-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-08-19
  • 2021-11-18
相关资源
相似解决方案