我正在尝试在 SQL Server 2008 中使用新的“MERGE”语句。该语句将从临时表中获取记录并在其他表中更新相同的记录。语句如下:
create table #TempTable(ProcPOAmdDel_ProcessAmendmentId bigint,ProcPOAmdDel_SemiFinProdId bigint,ProcPOAmdDel_ChallanQty int)
MERGE PurProcessPOAmendmentDelivery AS pod
USING (SELECT ProcPOAmdDel_ProcessAmendmentId,
ProcPOAmdDel_SemiFinProdId FROM #TempTable ) AS temp
ON pod.ProcPOAmdDel_ProcessAmendmentId = temp.ProcPOAmdDel_ProcessAmendmentId AND
pod.ProcPOAmdDel_SemiFinProdId=temp.ProcPOAmdDel_SemiFinProdId
WHEN MATCHED THEN UPDATE
SET pod.ProcPOAmdDel_ChallanQty = temp.ProcPOAmdDel_ChallanQty;
在运行状态时我遇到了一个错误 Invalid column name'ProcPOAmdDel_ChallanQty'。
有人可以帮我解决这个问题吗?