我尝试创建一个触发器,该触发器可以更新名为“ Sala”的表,但是在“ inserted.sala_cod”,“ sala.sala_cod”和“ deleted.sala_cod”中标记的多部分标识符“界。有解决办法吗?
Create Trigger ModificarSala
on Sala
for update
as
begin
update plantilla
set sala_cod = inserted.sala_cod
from plantilla
where sala.sala_cod = deleted.sala_cod
select * from inserted
end
答案 0 :(得分:1)
您需要加入已插入和删除的
Create Trigger ModificarSala
on Sala
for update
as
begin
update p
set sala_cod = inserted.sala_cod
from plantilla p
join inserted on inserted.? = p.?
join deleted inserted.? = deleted.?
--join sala on sala.sala_cod = deleted.sala_cod --maybe this is needed? We need your DDL
end