如何得到JOB执行状态@execution_status ?

[复制链接]
查看11 | 回复3 | 2008-1-2 17:35:53 | 显示全部楼层 |阅读模式
我的某个JOB调用的过程须往链接服务器中insert into数据,因为网络连接不是太稳定,常常导致JOB死掉;
我想知道怎么样查看一个JOB的执行状态,如果它没“正在执行”的话,我就用sp_start_job把它启起来。
用sp_help_job确实可以看到JOB的信息,但要命的是它没法把@execution_status 输出给我判断呀?
对SQL SERVER了解很浅,希望诸位帮忙?
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
msdb
sp_help_job @execution_status =4output the Idle job
sp_help_job @execution_status =1 output the Executing job
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
猫咪的意思是
create proc check
as
declare @notexe int
begin
exec sp_*** @notexe output
if @notexe=1
exec sp_start_job ****
end
我就是需要这种效果, tigercat 你给猫咪的好象不成哎,或者猫咪没领会你意思?
回复

使用道具 举报

千问 | 2008-1-2 17:35:53 | 显示全部楼层
直接扫系统表判断,目前运行还好。谢谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行