Wednesday, May 9, 2007

List SQL Agent Jobs and owners


SELECT server_name = @@servername ,
    job_name    = jobs.[name],
    job_enabled = CASE WHEN jobs.Enabled = 0 THEN 'No' ELSE 'Yes' END,
    job_owner   = logins.[name]
FROM msdb.dbo.sysjobs jobs
INNER JOIN master.dbo.syslogins logins
ON jobs.owner_sid = logins.sid
ORDER BY jobs.[name]

No comments: