SQL Server 2008 - Ambiguous column name -
i trying join between 2 tables receiving error
ambiguous column name 'nurseward'
code:
select @wardid = nurseward dbo.nursetbl o inner join inserted on o.nurseid = i.nurseid
this looks inserted table in trigger. inserted table has same column names original table. linked article:
the inserted table stores copies of affected rows during insert , update statements. during insert or update transaction, new rows added both inserted table , trigger table. rows in inserted table copies of new rows in trigger table.
the query has alias on both nursetbl , inserted tables, , inner join uses aliases, select not. need add alias nurseward column in select:
select @wardid = o.nurseward -- or i.nurseward depending on need dbo.nursetbl o inner join inserted on o.nurseid = i.nurseid
Comments
Post a Comment