Database Mail Notification

  • sairam6819

    SSC Enthusiast

    Points: 175

    Hello ,

    Can you suggest me how to Receive a mail notification, not as soon as job completes but at a particular time after the job completion. In the job setup window, I just have an option in notifications as ' when job succeeds'. I want to get notified in the morning after job succeeds (job runs at night). May be I was thinking that I can use jobhistory tables (job_status column) and write a script such that if status is success, notify operator at particular time. Any suggestions would be appreciated.

  • peterdru401

    Mr or Mrs. 500

    Points: 535

    You can set some alert through an utility like after the successful completion of job you will receive a mail

    Use some monitoring software like this


    SSC Guru

    Points: 112212

    Add a step into the job which uses WAITFOR TIME command to delay the sending of the mail. Then execute a msdb.dbo.sp_send_dbmail command with the mail you want to send.

    I would do two, one for success one for failure, then set the main job step to go to the right mail step depending on its outcome.


    Step1 - Run my procedure, on success go to step2, on failure go to step3

    Step2 - WAITFOR TIME '07:30' send success mail, on success quit reporting success, on failure quit reporting failure

    Step3 - WAITFOR TIME '07:30' send failure email, on success quit reporting failure, on failure quit reporting failure

    How to post data/code for the best help - Jeff Moden[/url]
    Need a string splitter, try this - Jeff Moden[/url]
    How to post performance problems - Gail Shaw[/url]
    Managing Transaction Logs - Gail Shaw[/url]
    Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger[/url]

Viewing 3 posts - 1 through 3 (of 3 total)

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