合并错误 - SQL

时间:2012-03-14 17:18:43

标签: sql sql-server-2008

我正在尝试在sql server 2008中第一次使用merge函数,如下所示:

MERGE PriceFeed AS t
USING Products AS src
ON t.sku = src.sku

WHEN MATCHED THEN
  UPDATE
    SET src.price = t.price
;

但是我收到了错误"The multi-part identifier "src.price" could not be bound."并且在这种情况下不确定原因?

Feed数据中的sku与产品表中的sku匹配。

1 个答案:

答案 0 :(得分:0)

MERGE PriceFeed AS t
USING Products AS src
ON t.sku = src.sku

WHEN MATCHED THEN
  UPDATE
    SET t.price = src.price
;

在这里检查MERGE语法。这里用例子很好地解释了它。

http://blog.sqlauthority.com/2008/08/28/sql-server-2008-introduction-to-merge-statement-one-statement-for-insert-update-delete/