A Way to Handle Raised Errors in Both Dynamic and Static SQL Code
If you've needed a reliable way to handle errors that might be raised in both dynamic and static SQL code, here is what I've been doing: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: Erland Sommarskog - http://www.sommarskog.se/error_handling_2005.html -- Create date: 2009/11/29 -- Description: **Call this sp from within your -- CATCH block** This -- reraises/throws the most recent -- error. Please see -- http://w...