For a particular column if both trigger and constraint are assigned. which one is going fire first and why?
For a particular column if both trigger and constraint are assigned. which one is going fire first and why?
My understanding is that the firing order is as follows:
http://msdn.microsoft.com/en-us/library/aa224775(SQL.80).aspx
You also asked for the reason. An INSTEAD OF trigger has to fire first since it completely replaces the operation. Then constraints are checked (since we now have all the new data in place). Finally, AFTER triggers fire. AFTER triggers are not part of the query plan for the original data modification - a new plan is created for them - so logically they must come last.
No one has followed this question yet.