January 27, 2009 at 9:06 am
Hi All!
I would like to know how i can code the following to email myself upon a database backup failure.
This is what I have so far..
exec msdb.dbo.sp_send_dbmail
@recipients=name@company.com,
@subject = 'Full Database Backup Failed'
@body='Error:" + "I want the error message here...."
Any help appreciated.. thanks in advance!
¤ §unshine ¤
January 27, 2009 at 12:09 pm
SQL Magazine had a pretty nice article about a good way of doing that, in a way that I think puts out a nice format
http://www.sqlmag.com/Article/ArticleID/96056/sql_server_96056.html
if you can not get it there, there is discussion about it on SQL Team at
January 27, 2009 at 12:54 pm
Another way to go about it for all Errors and not just errors generated by jobs in SQL Agent can be found on my Automating Common DBA Tasks Series:
http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=AutomatedDBA&referringTitle=Home
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
January 27, 2009 at 1:01 pm
Its actually for a dts package. In order, simultaneously, it runs the backup task and on failure, it sends an email, however, i just want to add the error message to the email.
¤ §unshine ¤
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply