"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:OqjwOqBXHHA.1764@TK2MSFTNGP04.phx.gbl...
> sysjobhistory will have run_status = 0 AND [message] LIKE 'The job
> failed.%' where step_id = 0 and job_id = x.
>
> --
> Aaron Bertrand
> SQL Server MVP
>
http://www.sqlblog.com/ >
http://www.aspfaq.com/5006 >
>
>
>
> "JFB" <help@jfb.com> wrote in message
> news:%23hVqPWBXHHA.3568@TK2MSFTNGP06.phx.gbl...
>> Hi Aaron,
>> I can see this objects and I got the report of the jobs and the date time
>> when suppost to run but how can I get if the last time the job success or
>> failed?
>> select v.originating_server, v.name, v.job_id, Max(a.run_requested_date)
>> as requested_date,
>>
>> Max(a.next_scheduled_run_date) as next_run_date
>>
>> from msdb.dbo.sysjobs_view v
>>
>> inner join msdb.dbo.sysjobactivity a
>>
>> on v.job_id = a.job_id
>>
>> where v.enabled = 1
>>
>> group by v.originating_server, v.name, v.job_id
>>
>> Tks
>>
>> JFB
>>
>>
>>
>> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in
>> message news:%23wHAc30WHHA.4832@TK2MSFTNGP04.phx.gbl...
>>>I assume SQL Server 2005? I do something similar using these objects:
>>>
>>> msdb..sysjobs_view
>>> msdb..sysjobactivity
>>> msdb..sysjobhistory
>>>
>>> --
>>> Aaron Bertrand
>>> SQL Server MVP
>>>
http://www.sqlblog.com/ >>>
http://www.aspfaq.com/5006 >>>
>>>
>>>
>>>
>>>
>>> "Tom" <Tom@discussions.microsoft.com> wrote in message
>>> news:9F597F37-D40F-4E86-A11D-E96D32AA67CF@microsoft.com...
>>>> can someone tell me what table or stored procedure that the Job
>>>> Activity tool
>>>> uses to show the activity for the jobs on the db server? I'm asking
>>>> because
>>>> I'm creating a web form that list all db servers on the network and all
>>>> the
>>>> jobs under SQL Server Agent, and I need to show the status of the job
>>>> that is
>>>> running that was selected from the web form.
>>>>
>>>> Example:
>>>> when the user selects a job they can run it, but I want to show this on
>>>> my
>>>> web form
>>>> Jobname
>>>> Step 1 processing. . . .
>>>> Step 1 completed Succeeded
>>>>
>>>> Step 2 processing. . . . .
>>>> Step 2 completed Succeeded
>>>>
>>>> and so one, I noticed that the Job Activity is showing this
>>>> information. So
>>>> how can I use the job activity monitor on my web form or use the stored
>>>> procedure or table that the tool is using?
>>>>
>>>
>>>
>>
>>
>
>