无法在表'汽车'上创建INSTEAD DELETE或INSTEAD UPDATE TRIGGER'cartriggerupdatedelete'。这是因为该表具有带有级联DELETE或UPDATE的FOREIGN KEY。 [英] Cannot create INSTEAD of DELETE or INSTEAD of UPDATE TRIGGER 'cartriggerupdatedelete' on table 'cars'. This is because the table has a FOREIGN KEY with cascading DELETE or UPDATE.

查看:613
本文介绍了无法在表'汽车'上创建INSTEAD DELETE或INSTEAD UPDATE TRIGGER'cartriggerupdatedelete'。这是因为该表具有带有级联DELETE或UPDATE的FOREIGN KEY。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在更新之前插入表1到表2的特定行,我写这个查询但它不起作用,



i want insert specific row from table 1 to table 2 before update, i write this query but its not working,

CREATE TRIGGER [CarTriggerUpdateDelete]
ON [Cars]
BEFORE OF UPDATE
AS
BEGIN
    UPDATE Cars SET 
      Car_No = 5224,
      Car_shs = 12316354312
    FROM Cars AS t
    INNER JOIN CarTriggerUpdateDelete AS i
    ON t.Car_id = i.Car_id
	where t.Car_id = 6666
END
GO





我尝试了什么:



如何在sql server更新之前使用Trigger



What I have tried:

How i use Trigger before update in sql server

推荐答案

如果您收到错误消息但不明白,请输入错误:这是因为该表有一个带有级联删除或更新的外键 - Google搜索 [ ^ ]

As你可以看到,你并不是第一个遇到这个问题的人,谷歌将直接带你到解决方案:使用触发器解决SQL Server多级联路径问题 [ ^ ]很多,更快而不是在这里问...
If you get an error message you don't understand, google the error: this is because the table has a foreign key with cascading delete or update - Google Search[^]
As you can see, you aren't the first to have this problem, and that google will take you straight to the solution: Solving the SQL Server Multiple Cascade Path Issue with a Trigger[^] a lot, lot quicker than asking here...


这篇关于无法在表'汽车'上创建INSTEAD DELETE或INSTEAD UPDATE TRIGGER'cartriggerupdatedelete'。这是因为该表具有带有级联DELETE或UPDATE的FOREIGN KEY。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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