SELECT
'EXEC MSDB.dbo.sp_update_job ' + char(13) +
'@job_name = ' + char(39) + replace(j.[Name], char(39), char(39)+char(39)) + char(39) + ',' + char(13) +
'@owner_login_name = ' + char(39) + 'sa' + char(39) + char(13) + char(13)
FROM MSDB.dbo.sysjobs j
INNER JOIN Master.dbo.syslogins l
ON j.owner_sid = l.sid
WHERE l.[name] <> 'sa'
ORDER BY j.[name]
|