I was going over sql server store procedures and decided to improve error handling with
try-catch code. Everything worked fine except that the RAISEERROR didn't send any emails to an operator.
The solution was simple all I had to do is to add "with log" option.
begin try
...
end try
begin catchraiseerror ('mydb.dbo.myproc failed!',16,1) WITH log
end catch
Thank you for visiting my blog. It is all started with Microsoft Word/Excel document recovery method that I implemented at work. My coworkers were so impressed that they “forced” me to create a webpage and post steps required for that method. Later I realized that not many people are reading this blog and I decided to keep it for myself and post here some code and ideas that I could reuse for the future. If you find my posts useful drop a comment for me.
Thursday, January 19, 2012
Sending Emails with RAISEERROR
Labels:
SQL Server
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment