SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 E-mail notification for job success and fail
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

49 Posts

Posted - 06/18/2013 :  00:34:09  Show Profile  Reply with Quote
Hi Guys,

Am i using SQL Server 2005 and I am writing a SQL Server Agent Job. In my Job, there is one step and in step I will execute a store procedure.
My question is, i want send email nitificaton if job fail and success both cases also if job success(duraion,runtime,jobname),if job fail(jobname ,error message).

Please help me it's urgent works.


Flowing Fount of Yak Knowledge

2240 Posts

Posted - 06/18/2013 :  00:44:24  Show Profile  Reply with Quote
I don't know much about Agent Jobs.. This link might help you to
get the information regarding agent jobs


Edited by - bandi on 06/18/2013 00:45:55
Go to Top of Page

Very Important crosS Applying yaK Herder

52325 Posts

Posted - 06/18/2013 :  00:46:03  Show Profile  Reply with Quote
You can configure in sql server agent job itself to send mail as a notification.

But if you want to customize it to send specific details you should add a new step to send the mail using sp_send_dbmail. For the main step (stored procedure) on failure make it goto the new step created.
Similraly create another step for success mail.
Create a control table which will log results of procedure run. In the email steps read values from the table (errormessage,etc for failure and duration etc for success) and then pass the results to sp_send_dbmail


SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000