• Phil Parkin (8/5/2013)


    [bBut note that BOL suggests using THROW rather than RAISERROR for applications built in 2012 and onwards.

    Microsoft are keen on recommending on what they happened to come most recently. Note that ;THROW works somewhat differently from RAISERROR, which can trip you if you change your code blindly.

    Error handling in SQL Server is a big big big mess. And they only made that mess bigger in SQL 2012 with adding ;THROW to the mix. Previously, you could rely on that if the batch was aborted, your transaction was rolled back, but this is no longer true. Casual use of ;THROW can result in orphaned transactions, so be careful!

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]