use test2008
go
if exists (select * from dbo.sysobjects where ID = object_ID(N'[dbo].[p_killspID]') and OBJECTPROPERTY(ID,N'IsProcedure') = 1)
drop procedure [dbo].[p_killspID]
GO
create proc 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
--用法 exec p_killspID test2008
总结以上是内存溢出为你收集整理的sqlserver 杀死死锁进程全部内容,希望文章能够帮你解决sqlserver 杀死死锁进程所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)