如何使用sql server执行BEFORE UPDATED触发器? [英] How can I do a BEFORE UPDATED trigger with sql server?

查看:1370
本文介绍了如何使用sql server执行BEFORE UPDATED触发器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Sqlserver express,我不能在更新之前做触发。还有另一种方法可以做到这一点?

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

推荐答案

MSSQL不支持BEFORE触发器。最接近的是INSTEAD OF触发器,但它们的行为不同于MySQL中的BEFORE触发器。

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.

您可以了解更多关于它们的信息此处,并注意INSTEAD OF触发器指定执行触发器而不是触发SQL语句,从而覆盖触发语句的动作。因此,如果触发器未被正确写入/处理,则可能不会发生对更新的动作。级联操作也会受到影响。

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.

这篇关于如何使用sql server执行BEFORE UPDATED触发器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆