FROM
DW_Stage.PreStage.FilteredCoupon c
INNER JOIN
DW.Linkage l WITH (nolock)
REPLACE([l.CouponNumber], '/', '') ON (c.CouponSeqNbr = l.CouponNumber
AND c.PNRCreateDate = l.PNRCreateDate
AND c.PNRLocator = l.PNRLocator
AND c.PrimaryDocNbr = l.PrimaryDocNbr)
因此有两条记录在CouponNumber中有一个'/',导致我的SSIS包失败。如果我使用这个REPLACE函数,这将是最好的用途吗?或者应该在ON部分使用REPLACE功能?感谢
答案 0 :(得分:1)
您需要replace()
部分中的on
。你的语法没有意义。但你也想删除方括号:
FROM DW_Stage.PreStage.FilteredCoupon c INNER JOIN
DW.Linkage l
ON c.CouponSeqNbr = REPLACE(l.CouponNumber, '/', '') AND
c.PNRCreateDate = l.PNRCreateDate AND
c.PNRLocator = l.PNRLocator AND
c.PrimaryDocNbr = l.PrimaryDocNbr
括号ON
条件也没有增加任何价值。
答案 1 :(得分:0)
FROM
DW_Stage.PreStage.FilteredCoupon c
INNER JOIN
DW.Linkage l WITH (nolock)
ON
(
c.CouponSeqNbr = REPLACE([l.CouponNumber], '/', '')
AND c.PNRCreateDate = l.PNRCreateDate
AND c.PNRLocator = l.PNRLocator
AND c.PrimaryDocNbr = l.PrimaryDocNbr )