Home Forums SQL Server 7,2000 T-SQL T-SQL statement to return SQL Job Last Run Date RE: T-SQL statement to return SQL Job Last Run Date

  • Word of warning : if the history has been purged/deleted then sysjobhistory will not display the same data as "Job Activity Monitor" i.e. "Job Activity Monitor" will display a last run date but this is not obtainable from running queries against sysjobhistory where the history has been purged because it just won't exist.

    Use sysjobactivity to obtain the "real" last run date and to be in agreement with "Job Activity Monitor".

    Try it; create a test job, run it a few times, manually delete the latest history records then run your query using sysjobhistory. You will find that your queries report an earlier last run time than SQL's "Job Activity Monitor".

    Does it matter ? Well it may do, I noticed this problem when deciding which jobs could be deleted. It seemed that some jobs were never run but this was not the case as the history had been deleted.