我有这个问题我正在创建,但我一直坚持这个错误:
[执行SQL任务]错误:执行查询"更新Tech_Helpline.dbo.Calls SET Tech_Helpline.d ..."失败,出现以下错误:"多部分标识符" LampsGarLive.dbo.i8pupu_Tech Hotline Primary Members.AssociationName"无法受约束。"。可能的失败原因:查询问题," ResultSet"属性设置不正确,参数设置不正确或连接未正确建立。
这两个表来自不同的数据库(在同一个SQL Server中)。我试图做的是将来自i8pupu表(AssociationName列)的AssociationNames合并到Calls Table(Association Column),其中(Calls.NRDS = [i8pupu_Tech Hotline Primary Members] .NRDSMember_id)。我需要保留Calls表中的所有行。
注意:我使用执行SQL任务工具将此代码放在SQL Server 2008R2 SSIS包中。
UPDATE Tech_Helpline.dbo.Calls
SET Tech_Helpline.dbo.Calls.Association = LampsGarLive.dbo.[i8pupu_Tech Hotline Primary Members].AssociationName
FROM Tech_Helpline.dbo.Calls As T1
LEFT JOIN LampsGarLive.dbo.[i8pupu_Tech Hotline Primary Members] AS T2
ON T1.NRDS = T2.NRDSMember_id
有人想帮我这个吗?谢谢你的帮助!
约什
答案 0 :(得分:3)
使用别名:
UPDATE T1
SET T1.Association = T2.AssociationName
FROM Tech_Helpline.dbo.Calls As T1
LEFT JOIN LampsGarLive.dbo.[i8pupu_Tech Hotline Primary Members] AS T2
ON T1.NRDS = T2.NRDSMember_id