I am new to modify existing SQL Agent jobs and I got requirement from my client that I need to rename the job with adding the description to it.
I am trying the below statement but it gives me Supply either @job_id or @job_name to identify the job.
error.
EXEC msdb.dbo.sp_update_job @job_id='CD63A0B5-522C-495D-BED5-D9F900F71202',
@job_name=N'JobName',
@new_name=N'NewJobName',
@enabled=0,
@description=N'The Description is now available.'
I don't know what am I missing over here.
The error means you need to specify either @job_id or @job_name to identify the existing job, but not both. You can use either of these scripts to accomplish the task:
EXEC msdb.dbo.sp_update_job @job_id='CD63A0B5-522C-495D-BED5-D9F900F71202',
@new_name=N'NewJobName',
@enabled=0,
@description=N'The Description is now available.';
GO
EXEC msdb.dbo.sp_update_job @job_name=N'JobName',
@new_name=N'NewJobName',
@enabled=0,
@description=N'The Description is now available.';
GO