notifications in sql agent

  • Hi, i went to look at notifications for my sql agent job and came away confused.  I changed the email notification to "on completion" but when i scripted it, it appeared to be focused on failure.  i didnt write the script, i just asked sql to script what it had while i was in notifications.

    the documentation at https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-update-job-transact-sql?view=sql-server-ver16 seems to be saying that notif level 2 is failure.   and the page notif is based on the eventlog notif value.

    what is going on?  I simply want certain people notified when the job completes regardless of status.

    notif1

    notif2

     

    notif3

     

     

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • That script snippet seems to update the wrong job.

    The obfuscated name is larger than "DWLoad" for the job name in the job properties screenshot.

    Are you sure you are comparing the modified job done in T-SQL with the right one in the GUI?

     

  • Ant-Green wrote:

    That script snippet seems to update the wrong job. The obfuscated name is larger than "DWLoad" for the job name in the job properties screenshot. Are you sure you are comparing the modified job done in T-SQL with the right one in the GUI?

    the update script is using the @JOB_ID - uniqueidentifier, instead of job name.

    bad practice really - always always update using job name as that way the script is portable between environments (where job_id is bound to be different)

  • Doh, thanks Frederico, more coffee certainly needed this morning

  • thx ant-green and frederico_fonseca.   the good news is that we are now getting notified when the job completes.

Viewing 6 posts - 1 through 5 (of 5 total)

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