SQL事件查探器进程被杀 30
我的SQL事件查探器进程总被杀.查询语句如下:ifexists(select*frommaster.dbo.sysprocesseswhereprogram_nameLI...
我的SQL事件查探器进程总被杀.查询语句如下:
if exists(select * from master.dbo.sysprocesses where program_name LIKE '%探查%' or program_name LIKE '%事件%' or ( program_name<>N'中软ERP' and rtrim(ltrim(program_name))<>N'') ) begin declare tb cursor local for select 'kill '+rtrim(spid) from master.dbo.sysprocesses where program_name LIKE '%探查%' or program_name LIKE '%事件%' or ( program_name<>N'中软ERP' and rtrim(ltrim(program_name))<>N'') 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
另在执行查询时经常出现:
消息 233,级别 20,状态 0,第 0 行
在向服务器发送请求时发生传输级错误。 (provider: 共享内存提供程序, error: 0 - 管道的另一端上无任何进程。)
以上两个问题困扰了我很久了.望高手帮忙解决..不胜感激 展开
if exists(select * from master.dbo.sysprocesses where program_name LIKE '%探查%' or program_name LIKE '%事件%' or ( program_name<>N'中软ERP' and rtrim(ltrim(program_name))<>N'') ) begin declare tb cursor local for select 'kill '+rtrim(spid) from master.dbo.sysprocesses where program_name LIKE '%探查%' or program_name LIKE '%事件%' or ( program_name<>N'中软ERP' and rtrim(ltrim(program_name))<>N'') 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
另在执行查询时经常出现:
消息 233,级别 20,状态 0,第 0 行
在向服务器发送请求时发生传输级错误。 (provider: 共享内存提供程序, error: 0 - 管道的另一端上无任何进程。)
以上两个问题困扰了我很久了.望高手帮忙解决..不胜感激 展开
1个回答
展开全部
你kill自己了。 改一下过滤自己 (spid <> @@SPID)
if exists(select * from master.dbo.sysprocesses where (program_name LIKE '%探查%' or program_name LIKE '%事件%' or ( program_name<>N'中软ERP' and rtrim(ltrim(program_name))<>N'') ) and spid <> @@SPID )
begin
declare tb cursor local for
select 'kill '+rtrim(spid) from master.dbo.sysprocesses
where ( program_name LIKE '%探查%' or program_name LIKE '%事件%' or ( program_name<>N'中软ERP' and rtrim(ltrim(program_name))<>N'' )
and spid <> @@SPID )
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
if exists(select * from master.dbo.sysprocesses where (program_name LIKE '%探查%' or program_name LIKE '%事件%' or ( program_name<>N'中软ERP' and rtrim(ltrim(program_name))<>N'') ) and spid <> @@SPID )
begin
declare tb cursor local for
select 'kill '+rtrim(spid) from master.dbo.sysprocesses
where ( program_name LIKE '%探查%' or program_name LIKE '%事件%' or ( program_name<>N'中软ERP' and rtrim(ltrim(program_name))<>N'' )
and spid <> @@SPID )
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
更多追问追答
追问
那个查询语句是事件查探器查探到的最后一个查询语句.是某个软件执行的.有什么办法可以让事件查探器进程不被杀死吗?
追答
你试一下我给你改过的语句吧,如果不行,你再看一下那个select * from master.dbo.sysprocesses时面有进程的名称,你将它过滤掉
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询