Skip to content
Advertisement

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

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

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement