Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
chbala85
Starting Member
49 Posts |
Posted - 2013-06-18 : 00:34:09
|
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. Thanks,krsh. |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-18 : 00:46:03
|
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_dbmailhttp://msdn.microsoft.com/en-us/library/ms190307.aspx------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|