send e-mail with an error description | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

send e-mail with an error description

I need send an automatic e-mail with the error number and/or description
I already have a script to send an e-mail with no problem
what I don’t know is how to get a error# and description and add this to my
e-mail in another words, if the job fails there is 3 cases 1- Job was completely sucessfully
2- Job was sucessfully with errors **** I need to send the error description
3- Job fail
You may want to use "@@ERROR" or "RAISERROR"…see BOL for details. Jon M
In the case of scheduled job then you need to output of job history to email, otherwsie as specified by Jon you need to capture the error within your code. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
More Error Handlings here [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /<a target="_blank" href=http://www.sommarskog.se/error-handling-I.html>http://www.sommarskog.se/error-handling-I.html</a><br /<a target="_blank" href=http://www.sommarskog.se/error-handling-II.html>http://www.sommarskog.se/error-handling-II.html</a><br /><br /><br />Madhivanan<br /><br />Failing to plan is Planning to fail
]]>