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 |
workstuff
Starting Member
2 Posts |
Posted - 2010-06-07 : 12:48:59
|
HiI have a sql job running and I know that I can send email notification when it fails but how do I send an email and also log the actual error that caused the sql job to fail. The job basically calls a stored procedure that has try-catch blocks to safeguard against failures but I have noticed that some job still fail and the job history does not provide any real cause as to the failure. Can this be done in script and is there any examples that I can look at?- Kanthi |
|
jimmycjen
Starting Member
15 Posts |
Posted - 2010-06-08 : 15:13:13
|
From Management Studio, right click Database Mail and Configure Database Mail - you will need a SMTP server for this. You also need to setup a profile. Also, you need to turn on "Database Mail XPs" from sp_configure. After all these are setup, then you can set your job step to call sp_send_dbmail upon on failure. |
 |
|
|
|
|