SSIS 处理 NULL 和空格
你好,我是SSIS新手,iam接收SSIS iam创建的文本文件,使用向导将其加载到oracle表,但在文本文件中,有些列包含字符串NULL,其他列包含空白字符串而不是零长度列,是否有自动方式为了使这些值成为表中的实际空值,还是我必须为每种情况创建派生列,
谢谢,
hello i am new to SSIS and iam receiving text file created by SSIS iam using wizard to load it to oracle table but in the text file there is columns contain the String NULL and other contain blank string instead of zero length column is there an auto way to make these value to become actual null value in the table or do i have to create derived column for each one of theses cases
thank you,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在 Visual Studio 2015/SQL Server 2016 的 SQL Server 数据工具中的 SSIS 项目中,处理空列的方法似乎是通过平面文件源组件的属性(不确定仅空格列是否符合条件) :
Within an SSIS project in the SQL Server Data Tools for Visual Studio 2015/SQL Server 2016, the way to address the handling of empty columns seems to be via a property of the Flat File Source component (not certain whether space-only columns qualify):
如果您想在输入值为空/空白时将值转换为 null,那么您可以尝试(假设数据类型为 string/varchar):
If you want to convert the value into null if your input value in empty/blank, then you can try (under assumption datatype is of string/varchar) :
我遇到了同样的问题,您可以使用脚本组件并添加下面的代码来循环所有列,并将每个文本 null 替换为实际的 null 值...
代码解释为 此处
I faced the same issue, you can use a script component and add the code below to loop through all the columns and replace each text null with actual null value...
Code explanation is here
如果您使用的是 SSIS 2008,还可以使用 Tactek Data Systems 的 Null Manager 组件。它不是免费的,但相当便宜——大约 10 美元。 (www.tactek.com)。您可以将空字符串转换为 null,将 null 转换为空字符串,并将 null 转换为“填充”值,例如“Unknown”或“NA”。
If you're using SSIS 2008, there's also the Null Manager component from Tactek Data Systems. It isn't free, but it's pretty cheap - like $10 bucks. (www.tactek.com). You can convert empty strings to nulls, nulls to empty strings, and nulls to "filler" values like "Unknown" or "NA".
我认为没有任何方法可以使用 SSIS 提供的标准平面文件源来做到这一点。为此,我使用了一个名为“分隔文件源”的自定义组件,可以在此处下载该组件:http://ssisdfs。 codeplex.com/。正如其名称所示,它在处理分隔文件方面也更加出色,而且它还可以选择将空字符串视为 NULL。
I don't think there is any way to do this using the standard Flat File Source SSIS provides. To do this I make use of a custom component called Delimited File Source, which can be downloaded here: http://ssisdfs.codeplex.com/. As its name indicates, it's also much better at handling delimited files, plus it has the option of treating empty strings as NULL.