次の方法で共有


EnumJobs Method

この機能は、将来のバージョンの Microsoft SQL Server では削除される予定です。新規の開発作業ではこの機能を使用しないようにし、現在この機能を使用しているアプリケーションは修正することを検討してください。

The EnumJobs method returns a QueryResults object that enumerates all Microsoft SQL Server Agent jobs defined for a server.

構文

object
.EnumJobs( [ JobFilter ] )as QueryResults

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • JobFilter
    Optional. A JobFilter object that restricts result set membership.

Prototype (C/C++)

HRESULT EnumJobs(
LPSQLDMOQUERYRESULTS* ppResults,
LPSQLDMOJOBFILTER pJobFilter = NULL);

Returns

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

Column Data type Description

category

nvarchar(129)

Job category name.

current_execution_/status

integer

Execution state interpreted using SQLDMO_JOBEXECUTION_STATUS.

current_execution_/step

nvarchar(129)

When applicable, the currently executing step. A string formatted as the job step identifier, a space character, and the name of the step.

current_retry_/attempt

integer

When applicable, the retry attempt for the job step.

date_created

smalldatetime

Date and time at which job was created.

date_modified

smalldatetime

Date and time of most recent modification to job, job steps, or schedules.

delete_level

integer

Execution outcome that causes an automatic delete of the job. Interpret using SQLDMO_COMPLETION_TYPE.

description

nvarchar(513)

Descriptive text.

enabled

tinyint

When 1, job is enabled.

has_schedule

integer

When 1, the job has at least one schedule enabled.

has_step

integer

When 1, the job has at least one step defined.

has_target

integer

When 1, the job has at least one execution target specified.

job_id

uniqueidentifier

System-generated job identifier.

last_run_date

integer

Most recent date on which execution occurred formatted as described in Remarks.

last_run_outcome

integer

Execution outcome of most recent execution attempt interpreted using SQLDMO_JOBOUTCOME_TYPE.

last_run_time

integer

Time at which most recent execution occurred formatted as described in Remarks.

name

nvarchar(129)

Job name.

next_run_date

integer

When applicable, next scheduled execution date formatted as described in Remarks.

next_run_schedule_/id

integer

Identifier of schedule generating next execution date and time.

next_run_time

integer

When applicable, next scheduled execution time formatted as described in Remarks.

notify_email_/operator

nvarchar(129)

Name of operator notified by e-mail.

notify_level_email

integer

Execution outcome causing operator notification by e-mail. Interpret using SQLDMO_COMPLETION_TYPE.

notify_level_/eventlog

integer

Execution outcome causing Microsoft Windows application log entry. Interpret using SQLDMO_COMPLETION_TYPE.

notify_level_netsend

integer

Execution outcome causing operator notification by network pop-up message. Interpret using SQLDMO_COMPLETION_TYPE.

notify_level_page

integer

Execution outcome causing operator notification by page. Interpret using SQLDMO_COMPLETION_TYPE.

notify_netsend_/operator

nvarchar(129)

Name of operator notified by network pop-up message.

notify_page_/operator

nvarchar(129)

Name of operator notified by page.

originating_server

nvarchar(31)

Network name of master server or the string (local).

owner

nvarchar(129)

Microsoft SQL Server database user identified as job owner.

start_step_id

integer

User-defined job step identifier specified as first step executed.

type

integer

Indicator of execution target interpreted using SQLDMO_JOB_TYPE.

version_number

integer

System-generated version number.

解説

The result set columns last_run_date and next_run_date represent execution dates as scaled long integers. The integers are 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 columns last_run_time and next_run_time represent execution times as scaled long integers. The integers are 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 JobFilter object. For more information, see JobFilter Object.

Applies To:

JobServer Object