Re: Error Handling Coming Out of a Trigger
- From: Brian Bushay TeamB <BBushay@xxxxxxxxx>
- Date: Wed, 20 Jun 2007 20:37:51 -0500
I have an after update trigger on a table. This trigger is used to helpTry raising the severity up to 19 or
enforce a business rule of not allowing a zero quantity.
I have the following code in the body of the trigger. I had expected that it
would have caused an exception in the calling application; because i am
using the RAISERROR statement. I also tried several different severity
levels but none worked for me. I get nothing back at all, no message and
certainly no exception.
-- Note this check below will allow for a "zero cost item" to be saved to
the
-- database. It will not however let the Quantity of any SL to be
-- zero or less.
If (@Qty IS NULL) OR (@Qty < 1) OR (@UC IS NULL) or (@UC < 0)
or (@Allowed IS NULL) OR (@Allowed < 0)
BEGIN
ROLLBACK TRANSACTION
SET @ErrMsg = 'The Service Line is not sufficiently setup to ' +
'effectively manage the GL system. The Quantity, Fee, and ' +
'Allowed values must be set prior to attempting to save. ' +
'Review these values and try again.'
RAISERROR(@ErrMsg, 16, 1);
RETURN
examine the TadoConnection.Errors collection to look for errors that are not
critical enough to trigger an exception
--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.
- Follow-Ups:
- Re: Error Handling Coming Out of a Trigger
- From: Brian Hollister
- Re: Error Handling Coming Out of a Trigger
- References:
- Error Handling Coming Out of a Trigger
- From: Brian Hollister
- Error Handling Coming Out of a Trigger
- Prev by Date: Re: Speed issue...
- Next by Date: Re: Error Handling Coming Out of a Trigger
- Previous by thread: Re: Error Handling Coming Out of a Trigger
- Next by thread: Re: Error Handling Coming Out of a Trigger
- Index(es):
Relevant Pages
|