Victorio Berra
Victorio Berra

Reputation: 3105

How do I tell an INSTEAD OF UPDATE trigger to continue and ignore my statement?

I have an INSTEAD OF UPDATE trigger that checks to see if I am populating a column called deleted_date, if so it will then perform an operation.

Everything was working great until I realized that if I try to update any other data my trigger runs and my update is ignored.

Other solutions I have found on stack explain that doing an IF/ELSE and then doing an UPDATE on the original table after joining the "inserted" table to it. This will work, however, this also means if I modify a tables columns in any way I have to go back and edit my trigger.

Is there a way to say ELSE CONTINUE DEFAULT ACTION to basically say "leave this trigger and update the records you would have normally done in the first place"

Upvotes: 0

Views: 1257

Answers (2)

Geoff
Geoff

Reputation: 8850

If you always want the update to happen, and sometimes want some additional processing to happen, you could use change to using an AFTER trigger (unless you're working with a view). Otherwise, you need to do the update statement inside the trigger.

Upvotes: 2

JamieA
JamieA

Reputation: 2013

No. When an instead of update trigger is fired, you cannot return to the default action. Any updates to the data in the table must be done by your trigger logic

Upvotes: 1

Related Questions