我正在运行以下语句,无法理解为什么update
影响 0 行,而 aselect
具有相同的连接并where
返回 1 行。它们都是类型Varchar
,并且 crmnumberAC 更大,因此应该能够从 AccountNumber 中获取字符串。想法?
begin transaction
update c
set c.crmnumberAC = a.AccountNumber
--select a.name, a.AccountNumber, c.fullname, c.crmnumberAC
from Contact as c
right join Account as a
on c.PFH_Mapping_Ac_ContacId = a.AccountId
WHERE (a.AccountNumber IS NOT NULL AND c.crmnumberAC IS NULL)
OR a.AccountNumber != c.crmnumberAC
rollback transaction
这是我取消注释select
并运行到where
;时的结果集