【问题标题】:SSIS Blank Int Flat File Fail on LoadSSIS 空白 Int 平面文件加载失败
【发布时间】:2015-01-22 18:36:30
【问题描述】:

我有一个用于加载固定宽度平面文件的 SSIS 包。我已经输入了所有的列长度,并且有两个针对类似文件的包正常工作。然而,第三个不断抛出以下错误:

[Source 1 [16860]] Error: Data conversion failed. The data conversion for column "Line Number"
returned status value 2 and status text "The value could not be converted because of a 
potential loss of data.".

[Source 1 [16860]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  
The "output column "Line Number" (16957)" failed because error code 0xC0209084 
occurred, and the error row disposition on "output column "Line Number" (16957)" 
specifies failure on error. An error occurred on the specified object of the specified 
component.  There may be error messages posted before this with more information about
the failure.

在进行一些测试后,我使用 DT_I4 数据类型的任何列都会发生这种情况,并且该列中有一个空白。我打算尝试使用派生列,但对于某些列,这似乎失败了,即使我将它们更改为字符串数据类型以将空白处理为 NULL,然后在数据流中稍后转换为 INT .

在源任务和目标任务中,我勾选了保留 NULL 值复选框,但这并没有改变任何内容。

在 INT 似乎无法将空白转换为 NULL 时处理此错误的任何建议?

【问题讨论】:

    标签: sql-server ssis null type-conversion


    【解决方案1】:

    DT_I4 映射到 SSIS 中的一个四字节有符号整数。

    您的派生列走在了正确的轨道上。您只需要添加正确的表达式即可。

    你可以试试这个表达式:

    ISNULL([Line Number]) ? "0":[Line Number]
    

    此链接也可能有用 - 请参阅示例中的邮政编码列 http://www.bidn.com/blogs/DonnyJohns/ssas/1919/handling-null-or-implied-null-values-in-an-ssis-derived-column

    【讨论】:

      【解决方案2】:

      我最终使用了这篇博文中的方法:

      http://www.proactivespeaks.com/2012/04/02/ssis-transform-all-string-columns-in-a-data-flow-stream/

      通过脚本任务和数据转换处理所有空列和空白列。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-23
        • 2018-10-07
        相关资源
        最近更新 更多