Freigeben über


EnumJobHistory Method

Diese Funktion wird in zukünftigen Versionen von Microsoft SQL Server nicht mehr bereitgestellt. Verwenden Sie diese Funktion beim Entwickeln neuer Anwendungen nicht, und planen Sie das Ändern von Anwendungen, in denen es zurzeit verwendet wird.

The EnumHistory method returns a QueryResults object that enumerates the execution history of all Microsoft SQL Server Agent jobs.

Syntax

object.EnumJobHistory( [ JobHistoryFilter ] )as QueryResults

Parts

  • object
    Expression that evaluates to an object in the Applies To list.

  • JobHistoryFilter
    Optional. A JobHistoryFilter object that restricts result set membership.

Prototype (C/C++)

HRESULT EnumJobHistory(
LPSQLDMOQUERYRESULTS* ppResults,
LPSQLDMOJOBHISTORYFILTER pJobHistoryFilter = NULL);

Returns

A QueryResults object that contains one result set defined by these columns.

Column

Data type

Description

instance_id

integer

System-generated identifier for execution attempt.

job_id

uniqueidentifier

System-generated job identifier.

job_name

nvarchar(129)

Job name.

message

nvarchar(1025)

When applicable, text of a SQL Server message raised by the step.

operator_emailed

nvarchar(129)

When applicable, operator receiving e-mail notification of job completion.

operator_netsent

nvarchar(129)

When applicable, operator receiving network pop-up message notification of job completion.

operator_paged

nvarchar(129)

When applicable, operator receiving page notification of job completion.

retries_attempted

integer

Number of times SQL Server Agent attempted execution of the step. 0 when the step executed successfully on the first attempt or no retry attempts specified for the job step.

run_date

integer

Date on which execution occurred formatted as described in Remarks.

run_duration

integer

Execution duration expressed as a number of seconds.

run_status

integer

Execution outcome interpreted using SQLDMO_JOBOUTCOME_TYPE.

run_time

integer

Time at which execution occurred formatted as described in Remarks.

server

nvarchar(31)

Target server name.

sql_message_id

integer

When applicable, the SQL Server message number of the message raised by the step.

sql_severity

integer

When applicable, the severity of a SQL Server message raised by the step.

step_id

integer

User-specified step identifier. The result set lists each job step and its outcome.

step_name

nvarchar(129)

Job step name.

Hinweise

The result set column run_date represents the execution date as a scaled long integer. The integer is built as a sum of the year scaled by 10000, the month scaled by 100, and the day. For example, the date April 19, 1997 is represented by the long integer value 19970419.

The result set column run_time represents execution time as a scaled long integer. The integer is built as a sum of the hour scaled by 10000, the minute scaled by 100, and the seconds. The value uses a 24-hour clock. For example, the time 1:03:09 P.M. is represented by the long integer value 130309.

Membership in the result set is restricted using the optionally specified JobHistoryFilter object. For more information, see JobHistoryFilter Object.

Applies To: