Select t2.Id,t2.Name ,t1.rsc_objid,Convert(Int,t1.req_spid) as req_spid from master.dbo.syslockinfo t1(nolock), YuorDataBaseName.dbo.sysobjects t2(nolock) Where t1.rsc_objid =* t2.Id and t2.name in(你查詢的tableName)kill req_spid(上面查詢出的進程號)
你可以从系统进程表 sysprocess 中找出要Kill的进程:declare @spid int declare Cu_A Cursor For select SpID from sysprocess Fetch Cu_A into @spid while @@FETCH_Stause=0 begin Kill @spid Fetch Cu_A into @spid end close CU_A deallocate Cu_A
To cop007 (框吉) : 对于一个正在执行的存储过程(例如:我插入1000万条纪录),我想通过程序中止,目前我只能Kill掉,可以 use masterdeclare @spid varchar(100)select @spid=spid from sysprocesses where status='runnable' order by spid exec('kill '+@spid)试验是成功的,别的办法我不知道,帮你Up
SELECT @Timeout = @@lock_timeout
SELECT @Timeout
from master.dbo.syslockinfo t1(nolock),
YuorDataBaseName.dbo.sysobjects t2(nolock)
Where t1.rsc_objid =* t2.Id and t2.name in(你查詢的tableName)kill req_spid(上面查詢出的進程號)
declare Cu_A Cursor For select SpID from sysprocess
Fetch Cu_A into @spid
while @@FETCH_Stause=0
begin
Kill @spid
Fetch Cu_A into @spid
end
close CU_A
deallocate Cu_A
对于一个正在执行的存储过程(例如:我插入1000万条纪录),我想通过程序中止,目前我只能Kill掉,可以
use masterdeclare @spid varchar(100)select @spid=spid from sysprocesses
where status='runnable' order by spid exec('kill '+@spid)试验是成功的,别的办法我不知道,帮你Up