SQL Error Codes

When handling SQL Exceptions, it’s pretty handy to know which error codes relate to which errors…or at least it is for me as I’m currently writing some exception handling routines that work off the error code. So to get a list of all SQL error codes, along with descriptions, simply perform the following SELECT statement on the master database:

SELECT * FROM sysmessages


The Exception Handling Application Block

A friend of mine recently put me on to this, a fantastic exception handling design pattern by Microsoft that supports exception handling across multi-layered enterprise applications. It is fairly extensive, maybe too extensive for our needs but it has certainly helped further my understanding of implementing exception handling in multiple architectural layers.