Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have setup a profile and account for sending mail using DatabaseMail. I have a SQL JOB. If the job fails, I receive an Email

Till this point, everything works fine. This is what the email looks like :

JOB RUN:        'testjob' was run on 3/7/2014 at 4:50:00 PM
DURATION:       0 hours, 0 minutes, 0 seconds
STATUS:         Succeeded
MESSAGES:       The job succeeded.  The Job was invoked by Schedule 10 (s1).  The last step to run was step 1 (run).

Now what I want is, if the job fails for any reason, that error message should appear in the email message body.

for example, FK_Constraint error , Conversion errors or any error that caused my sql job to fail.

Is this possible ?

share|improve this question
Yes this can be done ! Here is an article that describes how this can be done using stored procs. – Up_One Mar 7 '14 at 13:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.