How to get Job Names with Owner Names in SQL Server - SQL Server Scripts

One way to check the owner of SQL Server agent Job is to Right Click on Job and go to Properties and then see the Owner.

If we need to get the owners for all the SQL Server Agent Job, that can be time consuming. We often need this information for Audit. We can use system objects such as sysjobs and syslogins from MSDB to get this information.


SELECT J.NAME AS JobName
    ,L.NAME AS OwnerName
FROM msdb..sysjobs J
LEFT JOIN master.sys.syslogins L 
ON J.owner_sid = L.sid

If you see Null value in OwnerName that means that the login does not exists for the account used in Job as owner. It is good time to take care of that.



You can use below query to return all job names with owners, even for those logins does not exists.

SELECT NAME AS JobName
    ,SUSER_SNAME(owner_sid) AS JobOwner
FROM msdb..sysjobs
ORDER BY NAME

4 comments:

  1. That is not to say that you should just apply for the first job opening that presents itself. As a matter of fact, the opposite is true. Choose a career field that may benefit from your professional knowledge. Your best option is to look at a small geographic area and determine what employers are within this region. corr recruitment

    ReplyDelete
  2. I can deliver you the address Here you may learn how to do it accurately. Studied and type in something great. unicvv

    ReplyDelete
  3. Does anyone know a good resource with various vacancies? Of course, I understand that now the IT sphere and various developers, creators, programmers are in great demand. But I am an electrician and I can hardly find a good job.

    ReplyDelete
  4. Oh, I understand you very much. To be honest, it's annoying. As a result, it is quite difficult to find a competent specialist both in one area and in another. I think you need go layboard. There are quite a lot of jobs on this platform, including for electricians. If you are ready to moving abroad, such solutions can be considered there.

    ReplyDelete