Reputation: 91
I try to create a trigger which can update a table named "Sala", but in "inserted.sala_cod", "sala.sala_cod" and "deleted.sala_cod" is marking The multi-part identifier "" could not be bound. Any solution?
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
Upvotes: 1
Views: 107
Reputation: 25112
You need to join to the inserted and deleted
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
Upvotes: 1