Start date/time of currently running jobs

  • I've found plenty of questions related to this but so far no satisfactory outcome. Nothing in this forum either.

    Running SQL Server 2000 SP4.

    Basically, I'm trying to retrieve (programatically, T-SQL) the starting date/time of jobs that are currently running. History is no problem. But SQL must get the start date from somewhere in order to derive history values.

    Any help appreciated

     

    Kevin Pickering

  • I never came up with this problem.  What query have you come up with and what is the problem you are encountering?

  • In the msdb database if you query sys.jobs and sys.jobactivity and join them on the job_id and query for any jobs which have a start_execution and date and NULL for the stop_execution date I believe should give you what you want.

    hth

    David

     

  • Ok, in msdb we have dbo.sysjobs (not sys.jobs) but we do not have sys.jobactivity (nor dbo.sysjobactivity). Can you explain where this is located. It sounds like it has the information I require.

    Thanks,

    Kevin

  • I am running sql server 2005 and the table dbo.sysjobactivity exists within it but maybe it does not on previous versions

    hth

     

    David

  • Use sysjobs and sysjobschedules

  • use sysjobs and sysjobschedules (join on job_id) will give you what you see in Management->SQL Server Agent->Jobs

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply