Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I have a query that returns the owner of jobs on an SQL instance, select s.name as JobName , s.owner_sid , ISNULL(L.name,'AccessViaGroup') as LoginName --Trying to figure out how to turn that ...
#2: Post edited
- I have a query that returns the owner of jobs on an SQL instance,
- ```
- select s.name as JobName
- , s.owner_sid
- , ISNULL(L.name,'AccessViaGroup') as LoginName --Trying to figure out how to turn that into a name.
- from msdb..sysjobs s
- left join master.sys.syslogins L on s.owner_sid = L.sid
- ```
When a job is created by someone who is logged on with access as part of group, their logon ID is displayed in the owner field of the job. Only the sid is returned in the above query. Their name/account is not `master.sys.syslogins` or `master.sys.server_principals` it must be someplace...- My task is to return the login name, for jobs owned by accounts that have access as part of a group.
- SQL Enterprise 2012 to 2019
- I have a query that returns the owner of jobs on an SQL instance,
- ```
- select s.name as JobName
- , s.owner_sid
- , ISNULL(L.name,'AccessViaGroup') as LoginName --Trying to figure out how to turn that into a name.
- from msdb..sysjobs s
- left join master.sys.syslogins L on s.owner_sid = L.sid
- ```
- When a job is created by someone who is logged on with access as part of group, their logon ID is displayed in the owner field of the job. Only the sid is returned in the above query. Their name/account is not in `master.sys.syslogins` or `master.sys.server_principals` it must be someplace...
- My task is to return the login name, for jobs owned by accounts that have access as part of a group.
- SQL Enterprise 2012 to 2019
#1: Initial revision
SID to login for access via a group
I have a query that returns the owner of jobs on an SQL instance, ``` select s.name as JobName , s.owner_sid , ISNULL(L.name,'AccessViaGroup') as LoginName --Trying to figure out how to turn that into a name. from msdb..sysjobs s left join master.sys.syslogins L on s.owner_sid = L.sid ``` When a job is created by someone who is logged on with access as part of group, their logon ID is displayed in the owner field of the job. Only the sid is returned in the above query. Their name/account is not `master.sys.syslogins` or `master.sys.server_principals` it must be someplace... My task is to return the login name, for jobs owned by accounts that have access as part of a group. SQL Enterprise 2012 to 2019