我MERGE
在两张桌子之间执行
MERGE indexdecomp.Constituent targ
USING (SELECT ic.ConstituentName
FROM indexdecomp.IndexConstituents ic) src
ON (((targ.Name = src.ConstituentName) OR (targ.Name IS NULL AND src.ConstituentName IS NULL)))
WHEN NOT MATCHED BY TARGET THEN
UPDATE SET
targ.Name = src.ConstituentName
;
在我的ON
条款中,我有以下谓词:
(targ.Name = src.ConstituentName) OR (targ.Name IS NULL AND src.ConstituentName IS NULL)
我有这个谓词,因为如果两个名称相等或两个名称都是`null,我认为它是匹配的。
是否有更好或更传统的方法来处理两null
列之间的相等性?什么方式会产生最快的执行?