SQL Server – List SQL Agent Jobs

Recently, I had a need to list the SQL agent jobs, owner names and whether each job was enabled or not. Here is the result:

    j.name AS AgentTaskName,
    SUSER_SNAME(j.owner_sid) AS JobOwner,
    WHEN (j.enabled = 1) THEN 'True' ELSE 'False' END AS Enabled
FROM msdb.dbo.sysjobs j
LEFT OUTER JOIN MASTER.DBO.syslogins l ON j.owner_sid = l.sid
ORDER BY j.enabled DESC, j.name

And, the results


This entry was posted in SQL, SQL Server. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.