Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

order of "RAISERROR" and "ROLLBACK TRANSACTION" in trigger

0 views
Skip to first unread message

V T

unread,
May 23, 2006, 1:47:23 PM5/23/06
to
Hello,

SQL manual generally suggests following code:

IF (some_check_within_insert_update_delete_trigger)
BEGIN
RAISERROR (....)
ROLLBACK TRANSACTON
END

My question is if anyody knows why RAISERROR (not ROLLBACK TRANSACTION) goes
first ?

Is there a particlular reason for that or difference just insignificant so
it is just a preference of a code writer ?

Any ideas ?

Thanks


Dan Guzman

unread,
May 23, 2006, 9:53:35 PM5/23/06
to
> Is there a particlular reason for that or difference just insignificant so
> it is just a preference of a code writer ?

Unless someone chimes in otherwise, I believe the order is simply
preference. I usually ROLLBACK and then RAISERROR but I haven't been
consistent over the years.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"V T" <morea...@hotmail.com> wrote in message
news:vWHcg.23277$43....@nnrp.ca.mci.com!nnrp1.uunet.ca...

0 new messages