Query to find RUNAS value for all Sqlserveragent tasks

  • When you setup SQLServerAgent jobs each task in a job has the "run as" box. This is unique for the task and is distinct from the job owner.

    Where in the built in views/catalogs in sqlserver is this value stored ?

    I'm hoping to build a SQL to pull all tasks, and their job names running under a given username.

    I've been googling and this isn't coming up in my results.

    Thanks.

  • Found it..... So nevermind and thanks!

    select s.name,l.loginname

    from msdb..sysjobs s

    left join master.sys.syslogins l on s.owner_sid = l.sid

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply