From: Andy B. on
What is the best way to format an error when using raiserror? I need to be
able to make it easy to unpack the error package on the client so it can get
all info needed. Or is the SQLException good enough for catching sql errors
on the client? This is with C#/VB 3.0.


From: Tom on
On Mar 25, 11:13 am, "Andy B." <a_bo...(a)sbcglobal.net> wrote:
> What is the best way to format an error when using raiserror? I need to be
> able to make it easy to unpack the error package on the client so it can get
> all info needed. Or is the SQLException good enough for catching sql errors
> on the client? This is with C#/VB 3.0.

While debugging something when you got an error what was missing? I
like to include the values of all input parameters and any values
computed prior to the error. TRY CATCH makes this quite simple. There
is also a number of CATCH functions whose return value I also include.
In the CATCH block I declare a VARCHAR(MAX) and concatenate all these
together and present them with raiserror. RAISERROR has a character
limit so put the important things first.
From: Andy B. on

"Tom" <tom.groszko(a)charter.net> wrote in message
news:4c727b5f-3643-4740-9d45-729f8a0493ac(a)h18g2000yqo.googlegroups.com...
On Mar 25, 11:13 am, "Andy B." <a_bo...(a)sbcglobal.net> wrote:
> What is the best way to format an error when using raiserror? I need to be
> able to make it easy to unpack the error package on the client so it can
> get
> all info needed. Or is the SQLException good enough for catching sql
> errors
> on the client? This is with C#/VB 3.0.

While debugging something when you got an error what was missing? I
like to include the values of all input parameters and any values
computed prior to the error. TRY CATCH makes this quite simple. There
is also a number of CATCH functions whose return value I also include.
In the CATCH block I declare a VARCHAR(MAX) and concatenate all these
together and present them with raiserror. RAISERROR has a character
limit so put the important things first.

OK. Now, how would you format that? xml, delimited by ;? or comma? or |?
That way the client app can have access to all of the parts to the error and
not just the huge string. I.E. parse the string somehow.