Link to home
Start Free TrialLog in
Avatar of MarkMahon
MarkMahon

asked on

Email from Sql Server - How to change Subject line?

We have a overnight SQL job that upon completion sends out an email.

Everything works fine, but I'd like to change the subject line of the email.  I can not figure out where the subject line is defined.  At this point it seems to me that the format of the email is a default.

We get the following in the email ...

header info:
From: IT Adminsistrator (Administrator@company.com)
To: me; you
Subject: SQL Server Job System: 'Overnight_Job' completed on \\TestServer

body:
Jub Run: 'Overnight_Job' was run on mm/dd/yyyy at 2:30 am
Duration: 10 minutes
Status:     Succeeded
Messages: The Job succeeded.  The job was invoked by Schedule 17 (Overnight_Job) .  The last step run was step 20 (step 12c)

Is there a way to change the Subject line?  In the Subject line, I'd like to include Success or Failure, put the Server name first and the job name last.

Thank you,
Mark
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

You could just configure it to send an email if it failed. That way if you get one you know it has failed without having to read the email. I don't believe you can configure the email contents for this. I've never looked too deeply at this so I may be wrong.
Avatar of MarkMahon
MarkMahon

ASKER

Isavidge, thanks for the suggestion.  But we like the daily email as it gives us a sense of the job length.  
>>Everything works fine, but I'd like to change the subject line of the email.  I can not figure out where the subject line is defined.<<
What is generating this message?
acperkins ...

I don't understand your question ... the sentence you highlighted is not a part of the email but rather a part of my question  ">>Everything works fine, but I'd like to change the subject line of the email.  I can not figure out where the subject line is defined.<<"

The email is the following ....
header info:
From: IT Adminsistrator (Administrator@company.com)
To: me; you
Subject: SQL Server Job System: 'Overnight_Job' completed on \\TestServer

body:
Jub Run: 'Overnight_Job' was run on mm/dd/yyyy at 2:30 am
Duration: 10 minutes
Status:     Succeeded
Messages: The Job succeeded.  The job was invoked by Schedule 17 (Overnight_Job) .  The last step run was step 20 (step 12c)

ASKER CERTIFIED SOLUTION
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Isaidge - thanks for finding that question and comments.

If I get a few moments I might try the suggestion in the thread of sending the email via the sp_send_dbmail.  I have also used SSIS to successfully send email with modified Subject lines.