sysjobhistory

Transact-SQL Reference

Transact-SQL Reference

sysjobhistory

Contains information about the execution of scheduled jobs by SQL Server Agent. This table is stored in the msdb database.

Column name Data type Description
instance_id int Unique identifier for the row.
job_id uniqueidentifier Job ID.
step_id int ID of the step in the job.
step_name sysname Name of the step.
sql_message_id int ID of any Microsoft® SQL Server™ error message returned if the job failed.
sql_severity int Severity of any SQL Server error.
message nvarchar(1024) Text, if any, of a SQL Server error.
run_status int Status of the job execution:

0 = Failed
1 = Succeeded
2 = Retry
3 = Canceled
4 = In progress

run_date int Date the job or step started execution. For an In Progress history, this is the date/time the history was written.
run_time int Time the job or step completed.
run_duration int Elapsed time in the execution of the job or step in HHMMSS format.
operator_id_emailed int ID of the operator notified when the job completed.
operator_id_netsent int ID of the operator notified by a message when the job completed.
operator_id_paged int ID of the operator notified by pager when the job completed.
retries_attempted int Number of retry attempts for the job or step.
server nvarchar(30) Name of the server where the job was executed.