ssis数据转换和null处理
我从 Excel 电子表格中提取数据,并使用数据转换组件将数据转换为相关类型。我正在测试这个包,并注意到如果数据转换组件尝试转换的值为空,则它不会重定向行。这是正确的吗?在这种情况下我该如何处理空值。我应该检查堆栈上的空值吗?
Im pulling in data from an excel spreadsheet and using a data conversion component to convert the data to the relevant types. Im testing this package and have noticed that the data conversion coomponent does not redirect a row if the value it is trying to convert is null. Is this correct? How can i handle nulls in this situation. Should i check for nulls further up the stack?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当输入数据为无效的。可以将其视为 CAST(NULL AS char(10)) 或数据类型的 tsql 等效项。该转换应该始终成功,NULL 可以是任何数据类型。
转换的错误输出仅处理两类转换失败:错误(类型不兼容)和截断。
如果希望不允许字段中存在空值,我会在数据流中的某个位置使用条件分割来过滤掉这些行
NULL 值的快速演示不影响数据转换转换
在 OLE DB 源中,我发送了一行空值改变数据类型
在数据转换中,我尝试使用安全的东西(int 到 nvarchar)以及那些曾经的事情不太如此(nchar 到布尔值)
The Data Conversion Transformation doesn't error out when the input data is null. Think of it much like as the tsql equivalent of
CAST(NULL AS char(10))
or data type. That conversion should always succeed, NULL can be any data type.The error output for the transformation only handles two categories of conversion failure: error (incompatible type) and truncation.
If the desire is to not allow nulls in fields, I'd use conditional splits somewhere in your data flow to filter out those rows
Quick demo of NULL values not affecting Data Conversion Transformation
In an OLE DB source, I sent a row of nulls with varying data types out
In the data conversion, I tried it with things that were safe (int to nvarchar) and things that were less so (nchar to to boolean)