How can I do a BEFORE UPDATED trigger with sql server?(如何使用 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 触发器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 sql server 执行 BEFORE UPDATED 触发器?


基础教程推荐
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01