Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server SSIS空白Int平面文件加载失败_Sql Server_Ssis_Null_Type Conversion - Fatal编程技术网

Sql server SSIS空白Int平面文件加载失败

Sql server SSIS空白Int平面文件加载失败,sql-server,ssis,null,type-conversion,Sql Server,Ssis,Null,Type Conversion,我有一个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 o

我有一个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数据类型,列中有一个空白。我将尝试使用派生列,但对于某些列,如果将它们更改为字符串数据类型,将空白处理为空,然后在数据流中进行转换为int,则似乎失败。 在源任务和目标任务中,我勾选了保留空值复选框,但是这并没有改变任何事情


如果INT在将空白转换为NULL时失败,那么有没有处理此错误的建议?

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

您使用派生列的方法是正确的。您只需要添加正确的表达式

您可以尝试以下表达式:

ISNULL([Line Number]) ? "0":[Line Number]
此链接也可能有用-请参见示例中的邮政编码列

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

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