sSCH.Schedule_id,
--sSCH.Schedule_uid,
sSCH.Name,
sJOB.job_id,
sJOB.name AS JobName,
--sJSTP.command,
--sJOB.Description,
--sDBP.name AS JobOwner,
--sCAT.name AS JobCategory,
--sJOB.description AS JobDescription,
--sJOB.date_created AS JobCreatedOn,
--sJOB.date_modified AS JobLastModifiedOn,
--sSVR.name AS OriginatingServerName,
sJSTP.step_id AS JobStartStepNo,
sJSTP.step_name AS JobStartStepName,
--sJOB.enabled,
--sSCH.active_start_date,
--sSCH.active_start_time,
--sSch.Date_created,
--sSch.Date_modified,
--sSch.Version_number,
sJSTP.database_name,
sJSTP.command
--CASE WHEN sSCH.schedule_uid IS NULL THEN 'No' ELSE 'Yes' END AS IsScheduled,
--sSCH.schedule_uid AS JobScheduleID
--sSCH.name AS JobScheduleName,
--CASE sJOB.delete_level
-- WHEN 0 THEN 'Never'
-- WHEN 1 THEN 'On Success'
-- WHEN 2 THEN 'On Failure'
-- WHEN 3 THEN 'On Completion'
-- END AS JobDeletionCriterion
FROM msdb.dbo.sysjobs AS sJOB
LEFT JOIN msdb.sys.servers AS sSVR ON sJOB.originating_server_id = sSVR.server_id
LEFT JOIN msdb.dbo.syscategories AS sCAT ON sJOB.category_id = sCAT.category_id
LEFT JOIN msdb.dbo.sysjobsteps AS sJSTP ON sJOB.job_id = sJSTP.job_id
--AND sJOB.start_step_id = sJSTP.step_id
LEFT JOIN msdb.sys.database_principals AS sDBP ON sJOB.owner_sid = sDBP.sid
LEFT JOIN msdb.dbo.sysjobschedules AS sJOBSCH ON sJOB.job_id = sJOBSCH.job_id
LEFT JOIN msdb.dbo.sysschedules AS sSCH ON sJOBSCH.schedule_id = sSCH.schedule_id
where sJSTP.command like '%.dtsx%'
No comments:
Post a Comment