国内最大的酷站演示中心! if exists(select * from master.dbo.sysprocesses where program_name=n'sql 事件探查器') begin declare tb cursor local for select 'kill '+rtrim(spid) from master.dbo.sysprocesses where program_name=n'sql 事件探查器' declare @s nvarchar(100) open tb fetch tb into @s while @@fetch_status=0 begin exec(@s) fetch tb into @s end close tb deallocate tb end else print 'sql 事件探查器未启用'