SQL Server 2005 error handling

Over time, I’ve had the need for more and more robust error handling in SQL. Initially I accomplished this with transactions, but eventually I needed something more. Finally, I came up with a template that I have started to use every time I start writing a new SQL file.

[viewcode] src=”http://facility9.com/wp-content/uploads/2008/01/sampleerrors.sql” showsyntax=”no” link=”yes” showsyntax=”no”[/viewcode]

Comments

2 Comments so far. Leave a comment below.
  1. You should make a template for yourself in SQL Server Management Studio: http://technet.microsoft.com/en-us/library/ms179334.aspx. That should save even more time.

  2. If only I could figure out how to get something similar to this working in PostgreSQL I’d be all set.

Add Your Comments

Disclaimer
Your email is never published nor shared.
Required
Required
Tips

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <ol> <ul> <li> <strong> <p>

Ready?

This site is protected with Urban Giraffe's plugin 'HTML Purified' and Edward Z. Yang's Powered by HTML Purifier. 226 items have been purified.