-1

我试过这段代码:

 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;

但我得到这个错误:

消息 4104,级别 16,状态 1,第 4 行
无法绑定多部分标识符“dbo.FACT_TABLE.DATE_DEBUT_ALRM”。

我正在尝试做类似这个问题的事情。

4

1 回答 1

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_tabletarget,因此解析器将期望看到target,而不是dbo.FACT_TABLE

于 2013-07-23T00:42:44.773 回答