How can I do a BEFORE UPDATED trigger with sql server?

Bigballs picture Bigballs · Mar 13, 2009 · Viewed 136.6k times · Source

I'm using Sqlserver express and I can't do before updated trigger. There's a other way to do that?

Answer

achinda99 picture achinda99 · Mar 13, 2009

MSSQL does not support BEFORE triggers. The closest you have is INSTEAD OF triggers but their behavior is different to that of BEFORE triggers in MySQL.

You can learn more about them here, and note that INSTEAD OF triggers "Specifies that the trigger is executed instead of the triggering SQL statement, thus overriding the actions of the triggering statements." Thus, actions on the update may not take place if the trigger is not properly written/handled. Cascading actions are also affected.

You may instead want to use a different approach to what you are trying to achieve.