August 13, 2008 at 4:27 am
Hi Guys,
I created a SQL job and set the job to send an email alert on failure to the Operator. What should I do if I want to set up a personalised message on the job failure email alert.
I am currently getting this email alert:
JOB RUN:'master backup' was run on 8/13/2008 at 11:04:12 AM
DURATION:0 hours, 0 minutes, 0 seconds
STATUS: Failed
MESSAGES:The job failed. The Job was invoked by Alert 10. The last step to run was step 1 (Step 1).
Regards
IC
August 13, 2008 at 5:40 am
You could always remove the built in notifcation and create a new TSQL job step such to be something like:
If SQLMail is configured:
exec master.dbo.xp_sendmail
@recipients = 'SQLAlerts@mycompany.com',
@Subject = 'master backup failure',
@Message = 'The master backup has failed. You better sort it quick if you like your job'
If DatabaseMail is configured:
exec msdb.dbo.sp_send_dbmail
@recipients = 'SQLAlerts@mycompany.com',
@Subject = 'master backup failure',
@Body = 'The master backup has failed. You better sort it quick if you like your job'
Then set "on failure" for the backup step to go to the e-mail step. I'd then set the "on success action" and "on failure action" to be "Quit the job reporting failure" for the email step so you can easily spot it in the job activity.
Personally, I'd just stick with the built in notifications if you can get away with it as it's less administration.
HTH
ADam
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply