dbo.sysjobs (Transact-SQL)
Stores the information for each scheduled job to be executed by SQL Server Agent. This table is stored in the msdb database.
|
Column name |
Data type |
Description |
|---|---|---|
|
job_id |
uniqueidentifier |
Unique ID of the job. |
|
originating_server_id |
int |
ID of the server from which the job came. |
|
name |
sysname |
Name of the job. |
|
enabled |
tinyint |
Indicates whether the job is enabled to be executed. |
|
description |
nvarchar(512) |
Description for the job. |
|
start_step_id |
int |
ID of the step in the job where execution should begin. |
|
category_id |
int |
ID of the job category. |
|
owner_sid |
varbinary(85) |
Security identifier number (SID) of the job owner. |
|
notify_level_ eventlog |
int |
Bitmask indicating under what circumstances a notification event should be logged to the Microsoft Windows application log: 0 = Never 1 = When the job succeeds 2 = When the job fails 3 = Whenever the job completes (regardless of the job outcome) |
|
notify_level_email |
int |
Bitmask indicating under what circumstances a notification e-mail should be sent when a job completes: 0 = Never 1 = When the job succeeds 2 = When the job fails 3 = Whenever the job completes (regardless of the job outcome) |
|
notify_level_netsend |
int |
Bitmask indicating under what circumstances a network message should be sent when a job completes: 0 = Never 1 = When the job succeeds 2 = When the job fails 3 = Whenever the job completes (regardless of the job outcome) |
|
notify_level_page |
int |
Bitmask indicating under what circumstances a page should be sent when a job completes: 0 = Never 1 = When the job succeeds 2 = When the job fails 3 = Whenever the job completes (regardless of the job outcome) |
|
notify_email_ operator_id |
int |
E-mail name of the operator to notify. |
|
notify_netsend_ operator_id |
int |
ID of the computer or user used when sending network messages. |
|
notify_page_ operator_id |
int |
ID of the computer or user used when sending a page. |
|
delete_level |
int |
Bitmask indicating under what circumstances the job should be deleted when a job completes: 0 = Never 1 = When the job succeeds 2 = When the job fails 3 = Whenever the job completes (regardless of the job outcome) |
|
date_created |
datetime |
Date the job was created. |
|
date_modified |
datetime |
Date the job was last modified. |
|
version_number |
int |
Version of the job. |
AS
SELECT jobs.job_id,
svr.originating_server,
jobs.name,
jobs.enabled,
jobs.description,
jobs.start_step_id,
jobs.category_id,
jobs.owner_sid,
jobs.notify_level_eventlog,
jobs.notify_level_email,
jobs.notify_level_netsend,
jobs.notify_level_page,
jobs.notify_email_operator_id,
jobs.notify_netsend_operator_id,
jobs.notify_page_operator_id,
jobs.delete_level,
jobs.date_created,
jobs.date_modified,
jobs.version_number,
jobs.originating_server_id,
svr.master_server
FROM msdb.dbo.sysjobs as jobs
JOIN msdb.dbo.sysoriginatingservers_view as svr
ON jobs.originating_server_id = svr.originating_server_id
--LEFT JOIN msdb.dbo.sysjobservers js ON jobs.job_id = js.job_id
WHERE (owner_sid = SUSER_SID())
OR (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) = 1)
OR (ISNULL(IS_MEMBER(N'SQLAgentReaderRole'), 0) = 1)
OR ( (ISNULL(IS_MEMBER(N'TargetServersRole'), 0) = 1) AND
(EXISTS(SELECT * FROM msdb.dbo.sysjobservers js
WHERE js.server_id <> 0 AND js.job_id = jobs.job_id))) -- filter out local jobs
- 5/2/2012
- Paw Jershauge
System Procedure: sp_help_job http://msdn.microsoft.com/en-us/library/ms186722.aspx
System View: sysjobs_view
The system view "sysjobs_view" displays the "sysjobs" table & adds the text description for the Originating Server & adds a column "master_server"
There doesn't appear a specific page in Books Online for it.
Examples:
SELECT * FROM sysjobs
SELECT * FROM sysjobs_view
exec sp_help_job
- 4/4/2012
- DavidLean