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]