﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Administering / SQL Server 2005  / How to get the Job Status in Query / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 14:13:03 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: How to get the Job Status in Query</title><link>http://www.sqlservercentral.com/Forums/Topic853083-146-1.aspx</link><description>This will give you the current status of jobs running, saw it on a forum site I use it to monitor long running jobs, they are still running so no historyexecute master.dbo.xp_sqlagent_enum_jobs 1,                'garbage' -- doesn't seem to matter what you put hereAndrew</description><pubDate>Mon, 25 Jan 2010 15:20:26 GMT</pubDate><dc:creator>andrewkane17</dc:creator></item><item><title>RE: How to get the Job Status in Query</title><link>http://www.sqlservercentral.com/Forums/Topic853083-146-1.aspx</link><description>[quote][b]muthukkumaran (1/25/2010)[/b][hr]Right click job name--&amp;gt;view history...[/quote]The OP wants it deliberately from the query... I guess the OP might be aware of this..</description><pubDate>Mon, 25 Jan 2010 11:03:17 GMT</pubDate><dc:creator>Bru Medishetty</dc:creator></item><item><title>RE: How to get the Job Status in Query</title><link>http://www.sqlservercentral.com/Forums/Topic853083-146-1.aspx</link><description>[quote][b]haichells (1/25/2010)[/b][hr]Hi,Can anyone please help me the query to get the Status of Jobs in a server.. i.e for ex Job A - Executing ,Job B- Failed ,Job C - Success etc.,Thanks in Advance![/quote]Right click job name--&amp;gt;view history...</description><pubDate>Mon, 25 Jan 2010 10:59:04 GMT</pubDate><dc:creator>muthukkumaran Kaliyamoorthy</dc:creator></item><item><title>RE: How to get the Job Status in Query</title><link>http://www.sqlservercentral.com/Forums/Topic853083-146-1.aspx</link><description>To get the Job status information, we need to use the relevant information from two job related tables namely sysjobs and sysjobhistory.The run_status column of sysjobhistory has the current status of the job.You can refer to the following script:select distinct j.Name as "Job Name",h.run_date as LastStatusDate, case h.run_status when 0 then 'Failed' when 1 then 'Successful' when 3 then 'Cancelled' when 4 then 'Executing' end as JobStatusfrom msdb.dbo.sysJobHistory h, msdb.dbo.sysJobs jwhere j.job_id = h.job_id and h.run_date = (select max(hi.run_date) from msdb.dbo.sysJobHistory hi where h.job_id = hi.job_id)Hope this will help you...</description><pubDate>Mon, 25 Jan 2010 10:46:33 GMT</pubDate><dc:creator>Kumari Punam</dc:creator></item><item><title>How to get the Job Status in Query</title><link>http://www.sqlservercentral.com/Forums/Topic853083-146-1.aspx</link><description>Hi,Can anyone please help me the query to get the Status of Jobs in a server.. i.e for ex Job A - Executing ,Job B- Failed ,Job C - Success etc.,Thanks in Advance!</description><pubDate>Mon, 25 Jan 2010 09:21:23 GMT</pubDate><dc:creator>haichells</dc:creator></item></channel></rss>