database:mssql:list_jobs

MSSQL - Query Jobs with Owners

List jobs
SELECT s.name AS JobName, l.name AS JobOwner
FROM msdb..sysjobs s
LEFT JOIN master.sys.syslogins l ON s.owner_sid = l.sid
WHERE l.name IS NOT NULL
ORDER BY l.name
Reassign jobs
USE msdb ;
GO
EXEC dbo.sp_manage_jobs_by_login
@action = N'REASSIGN',
@current_owner_login_name = N'sa'
@new_owner_login_name = N'QUICK\Pinal', ;
GO
Enter your comment:
C S N I᠎ S
 
  • database/mssql/list_jobs.txt
  • Last modified: 2020-12-02 14:35
  • (external edit)