I am trying to write a trigger in Table1
to update a column in Table2
based on a condition in Table1
. I am not that good in SQL but enough to be dangerous. This script is not recognizing the column col2
in Table1
.
Create TRIGGER trgupd on Table1
After insert
AS
If Inserted.col2 = '1'
BEGIN
Update Table2
Set col3 = '2000' + the inserted value
From Table2
inner join inserted I on Table1.ID = Table2.ID
End