Just Add 50000

I've been doing my talk on try-catch in T-SQL for a while and whining about not being able to "rethrow" (via RAISERROR) a system error. Even went as far as writing a RegEx decoder so that I can copy the error into a user error message text and parse the text back on the client. Two weeks ago in a class, and again this week at TechEd, someone suggested the simple, relatively low-tech solution; "Just add 50000". RAISERROR to rethrow and subtract 50000 at the client. Unless you have already defined user errors in the range that can't be rethrown + 50000 (up to 13000), this should work fine. Thanks for the suggestion.

One thought on “Just Add 50000

  1. Hi Bob,

    You’re welcome. Sometimes a background in throwing errors to clients in the VB "classic" COM/ActiveX world comes in handy whilst doing T-SQL 2005 style 😉

    Great talks at Tech Ed, I really enjoyed them.

    Best regards,

    Didier

Comments are closed.

Other articles

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.