You are here: Re: Raising errors in a catch block in SQL2005 « MsSQL Server « IT news, forums, messages
Re: Raising errors in a catch block in SQL2005

Posted by Erland Sommarskog on 05/03/06 10:43

davidz (davidz@oz.net) writes:
> When a catchable error occurs in a try block, control is passed to the
> associated catch block. While I am then able to examine properties of
> the error using such functions as ERROR_NUMBER() in the catch block,
> the error-logging scheme used in my company requires that the actual
> error be raised so that it can be picked up by components in the next
> tier. I appear to be unable to do that

Correct. There is no re-raise operation in SQL 2005.

There is a fairly good work around. Just create a custom message, and then
format that message to include all essential information. The middle-tier
components will need to be adapted so if they this particular error number,
for instance 55555, they need to parse the message text to get the
components.

The new error-handling stuff in SQL 2005 is definitely too good to be
ignored!

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация