如果 SSIS 中的值为 NULL,则条件拆分失败 [英] Conditional Split fails if value is NULL in SSIS

查看:35
本文介绍了如果 SSIS 中的值为 NULL,则条件拆分失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据以下规则将 FULL Outer join 的结果传递给 Conditional Split and Filtering Records .基本上两个表具有相同的架构并且主键值相同.

I am passing result of FULL Outer join to Conditional Split and Filtering Records on the basis of following rules . Basically both tables has same schema and Primarykey values are same.

a. If Primary key of Source is NULL
b. If Primary Key of Destination is NULL
c. If Source and Destination key matches. 

它适用于 (a) 和 (b) 但不适用于 (c)

It works fine for (a) and (b) but fails for (c)

Source.Id == Destination.Id

并抛出异常,条件评估为 NULL,其中 Boolean 是预期的.我怎样才能做到这一点?

and throws exception that condition evaluated as NULL where Boolean was expected. How i can make this work?

Conditional Split 从 Merge Join 获取输入,这是一个 FULL OUTER JOIN 因为我需要这里的 FULL OUTER join 结果

Conditional Split gets input from Merge Join and it's a FULL OUTER JOIN as i need FULL OUTER join results here

推荐答案

在比较值之前,您的第三个条件应该以 ISNULL 检查开始.像下面这样:

Your third condition should start with a ISNULL check again before you compare your values. Like the following:

!ISNULL(Source.Id) && !ISNULL(Destination.Id) && Source.Id == Destination.Id

您需要处理条件中可能为 NULL 的每一列.由于您正在比较 Id,另一种选择是:

You need to handle every column that can be NULL in your condition. Since you are comparing Id's, another option would be:

(ISNULL(Source.Id) ? 0 : Source.Id) == (ISNULL(Destination.Id) ? 0 : Destination.Id)

如果比较字符串,可以用空格替换零.

If comparing strings, you can replace the zeroes with blank spaces.

这篇关于如果 SSIS 中的值为 NULL,则条件拆分失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆