views:

23

answers:

2

Hi

I think If a trigger run On Insert, and the insert statement was in transaction, an error in the trigger will return to the transaction and I can catch it and ROLLBACK.

Is that correct? Is there problems or concerns about that?

Thanks

A: 

That is a perfectly valid use of triggers, nothing wrong with it.

Trigger based constraints rely on this method.

Nick Craver
+1  A: 

This is true unless you actually call RAISEERROR yourself in the trigger. In that case you must actually call ROLLBACK TRANSACTION as well.

Nissan Fan