我试过这段代码:
Merge fact_table as target
using( select top 1 idDateDeb,PK_Date, Week_Of_Year from dbo.dim_date_Debut)
as source
on cast(source.PK_Date as date)=cast(dbo.FACT_TABLE.DATE_DEBUT_ALRM as date)
when matched then update set target.ID_TEMP_DEB=source.idDateDeb;
但是我收到了这个错误:
Msg 4104,Level 16,State 1,Line 4
无法绑定多部分标识符“dbo.FACT_TABLE.DATE_DEBUT_ALRM”。
我正在尝试做this question之类的事情。
答案 0 :(得分:1)
尝试:
Merge dbo.fact_table as target
using( select top 1 idDateDeb,PK_Date, Week_Of_Year from dbo.dim_date_Debut)
as source
on cast(source.PK_Date as date)=cast(target.DATE_DEBUT_ALRM as date)
when matched then update set target.ID_TEMP_DEB=source.idDateDeb;
您已将(dbo.
)fact_table
别名为target
,因此解析器可能会看到target
,而不是dbo.FACT_TABLE
。