INSTEAD OF Triggers

INSTEAD OF triggers fire instead of the original modification that was issued against the target object. The concept is a bit tricky: these are not BEFORE triggers that fire before the original statement actually runs; rather, they run instead of it. The original statement never reaches the target object. Rather, the trigger’s code replaces it. If the trigger is supposed to apply some integrity check and the modification passes the check, you will need to write your own code that "resubmits" the original activity. You can do so by querying the inserted or deleted table. Note that in an INSTEAD OF trigger, inserted and deleted hold the data that was supposed to be changed, as opposed to holding the data that actually changed. ...

Get Inside Microsoft® SQL Server™ 2005 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.