View SQL Server Agent job history

You created a job to run two SQL statements every day at 1:00pm. When you checked your job (Jobs view in Teratrax Database Manager) the next day, you noticed that it says “Failed” under “Last Run Status”.

Run the following SQL command to determine the cause of failure. It returns the job history of the specified job (replace job name with the name of your job):


job name‘, @MODE = N’SEM’



step_id step_name message run_status etc…
0 (Job outcome) The job failed. The… 0 etc…
1 Step1 Executed as user… 0 etc…




The middle cell in the second row contains the error messages that were recorded at the time the job ran. If the job was successful, the cell will still indicate the success status.