In SQL Trigger, getting "Ambiguous Column Name" error.
Posted on 2006-04-04
Assuming that a DTS package will act as an insert function on table Employees, I am trying to trigger creation of a SFT_Machine_Assignment record when one does not exist. Using the code below, gleaned from experts-exchange, I keep getting Error 209: Ambiguous Column Name 'IDNum'. (Line4)
CREATE TRIGGER [MachAssignmentUpdate] ON [dbo].[EMPLOYEES]
insert into SFT_Machine_Assignments (IDNum)
select IDNUM from inserted
left outer join SFT_Machine_Assignments
on inserted.IDNUM = SFT_Machine_Assignments.IDNum
where SFT_Machine_Assignments.IDNum is null
SFT_Machine_Assignment only has three fields, id, IDNum, Mach-Type - with a default of 'Unassigned'.
Employees has Uniqueid, IDNUM, etc.
How else can you qualifiy the IDNum in the Insert statement? If that is the problem.