无法绑定多部分标识符 - SET子句

时间:2021-01-26 09:17:44

I've searched for this answer, but most seem to come from the table being updated rather than the table having the information being taken from.

我已经搜索过这个答案,但大多数似乎来自正在更新的表而不是从中获取信息的表。

The first B.DED1 in the SET is the one throwing the multi-part identifier. Yet the one in the WHERE clause works just fine.

SET中的第一个B.DED1是抛出多部分标识符的B.DED1。然而,WHERE子句中的那个工作得很好。

UPDATE #output
SET col1 = B.DED1
SELECT * 
FROM #output A  
 INNER JOIN TableName B
 ON A.Key = B.Key
WHERE B.DED1 = 'col1'

2 个解决方案

#1


2  

UPDATE A
SET col1 = B.DED1
FROM [#output] A  
 INNER JOIN TableName B
 ON A.Key = B.Key
WHERE B.DED1 = 'col1'

#2


2  

Change your query as following:

更改您的查询如下:

UPDATE O SET col1 = B.DED1
FROM [#output] O  
INNER JOIN TableName B
ON O.Key = B.Key
WHERE B.DED1 = 'col1'

#1


2  

UPDATE A
SET col1 = B.DED1
FROM [#output] A  
 INNER JOIN TableName B
 ON A.Key = B.Key
WHERE B.DED1 = 'col1'

#2


2  

Change your query as following:

更改您的查询如下:

UPDATE O SET col1 = B.DED1
FROM [#output] O  
INNER JOIN TableName B
ON O.Key = B.Key
WHERE B.DED1 = 'col1'