none
Sqlserver Backup 2008- Change the subject of backup name RRS feed

  • Question

  • I followed http://community.dotnetwork.it/Excentric/archive/2010/09/16/configure-sql-server-database-mail-to-send-job-notifications.aspx

    to create backup notification and I would like to change the subject of email to Sql Server Message from

      SQL Server Job System: 'Fullbackup.Subplan_1' completed on \\server
    Wednesday, October 12, 2011 5:32 PM

Answers

  • If you want "SQL Server Message" as subject, then edit the *maint plan* and specify mail send in there.

    If you want something like "SQL Server Job System: 'Fullbackup.Subplan_1' completed on \\server", then specify mail notification at the Agent level.

    If you want something different from above two, then don't use maint plans, use some other solution, possibly ola.hallengren.com, and add a more intelligent mail notification (using sp_send_dbmail) on top of that.


    Tibor Karaszi, SQL Server MVP | web | blog
    • Proposed as answer by Peja Tao Friday, October 14, 2011 6:37 AM
    • Marked as answer by Peja Tao Wednesday, October 19, 2011 2:56 PM
    Thursday, October 13, 2011 5:57 AM
    Moderator

All replies

  • Can use dbo.sp_send_dbmail to send notifications which uses a mail profile which is already created.

    http://msdn.microsoft.com/en-us/library/ms190307.aspx

    A sample code is

    EXEC msdb.dbo.sp_send_dbmail
    @recipients =N'email ID here',
    @copy_recipients=N'email ID here',
    @body = @body,
    @body_format ='HTML',
    @importance= 'High',
    @subject ='Subject Goes here',
    @profile_name ='Profile Name'

     


    Anup | Forum Support| If you think my suggestion is useful, please rate it as helpful. If it has helped you to resolve the problem, please Mark it as Answer.

    Wednesday, October 12, 2011 5:57 PM
  • Okay, I used the following code to execute the email but it has no backup job associated with the email. How would I be able to associate backup job

    with the email. Thanks

    Wednesday, October 12, 2011 6:41 PM
  • If you want "SQL Server Message" as subject, then edit the *maint plan* and specify mail send in there.

    If you want something like "SQL Server Job System: 'Fullbackup.Subplan_1' completed on \\server", then specify mail notification at the Agent level.

    If you want something different from above two, then don't use maint plans, use some other solution, possibly ola.hallengren.com, and add a more intelligent mail notification (using sp_send_dbmail) on top of that.


    Tibor Karaszi, SQL Server MVP | web | blog
    • Proposed as answer by Peja Tao Friday, October 14, 2011 6:37 AM
    • Marked as answer by Peja Tao Wednesday, October 19, 2011 2:56 PM
    Thursday, October 13, 2011 5:57 AM
    Moderator