我有一个返回错误结果的更新查询。
UPDATE StagingWarehouse.dbo.BusinessLeads
SET CompanyFK = c.CustomerPK
FROM StagingWarehouse.dbo.BusinessLeads s
INNER JOIN DataWarehouse.dim.Customer c
ON c.CustomerBK = s.CompanyBK
WHERE s.businessleadbk = 5796722
businessleadbk = 5796722
从StagingWarehouse.dbo.BusinessLeads
运行此语句后选择时,CompanyFK
设置为 11024703。问题是CustomerPK
11024703 onDataWarehouse.dim.Customer
不存在并且运行以下查询不返回任何结果,所以我不知道它从哪里得到这个数字。
SELECT c.*
FROM StagingWarehouse.dbo.BusinessLeads s
INNER JOIN DataWarehouse.dim.Customer c
ON c.CustomerBK = s.CompanyBK
WHERE s.businessleadbk = 5796722