SSIS无法转换,因为可能会丢失数据

时间:2012-11-19 18:08:30

标签: ssis

我有一个SSIS包,可以从Excel文档导入数据库表。我收到以下错误:

[Excel Source [1]] Error: There was an error with output column "ShipTo" (47) on output
"Excel Source Output" (9). The column status returned was: "The value could not be 
converted because of a potential loss of data.".

[Excel Source [1]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The
"output column "ShipTo" (47)" failed because error code 0xC0209072 occurred, and the
error row disposition on "output column "ShipTo" (47)" 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.

[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method
on component "Excel Source" (1) returned error code 0xC0209029.  The component returned
a failure code when the pipeline engine called PrimeOutput(). The meaning of the
failure code is defined by the component, but the error is fatal and the pipeline 
stopped executing.  There may be error messages posted before this with more
information about the failure.

我已经阅读并找到文章以确保我的数据类型匹配,并且我已经完成了。在Excel文档中,有184行,并且在这些错误(shipto)中列出的列中,它们都具有相同的值,即“全部”。我最后一次运行时遇到了这个问题,但只有4行有“全部”,所以我只是手动输入了这些值,但这次效率不高。

在目的地表上,ShipTo列是一个Varchar(20),所以我看不出尺寸是一个问题,因为它是三件事之一:1位数字,2位数字或单词All。

有没有人有任何我可以尝试的额外想法?任何帮助是极大的赞赏。感谢任何可以提供任何帮助的人。

5 个答案:

答案 0 :(得分:26)

当您第一次设置此软件包时,我猜测一个或两个数字的数字是ShipTo列中的第一个值。您从Excel中读取的包选择了该输入字段的数字类型,并且单词“ALL”使包失败,因为该字段的输入规范是数字。有几种方法可以事先解决这个问题,但要事后修复它,最简单的方法是右键单击Excel Source并选择Show Advanced Editor ...从那里,选择显示输入和输出属性的选项卡。在该对话框的输入和输出部分的最顶部,找到ShipTo列。您将不得不向下钻取以找到它。将DataType设置为“string [DT_STR]”,长度设置为20。

单击“确定”,然后再次尝试运行包。

答案 1 :(得分:1)

我有同样的问题,单列中有多个数据类型值,包只加载数值。保持全部更新为null。

<强>解决方案

要解决此问题,更改Excel数据类型是解决方案之一。在Excel 复制列数据并粘贴到其他文件中。 删除该列将新列插入为文本数据类型,并将复制的数据粘贴到新列中。

现在在ssis包中删除并重新创建Excel源和目标表会将列数据类型更改为varchar

这样可行。

答案 2 :(得分:1)

对我来说,只是从SSIS中删除了OLE DB源并再次添加。工作!

答案 3 :(得分:0)

答案 4 :(得分:0)

这可能不是最好的方法,但是如果其他所有方法都失败,则可以忽略转换错误。我的问题是null不能正确转换,因此我只是忽略了错误,日期以日期的形式出现,而null以null的形式出现,因此没有数据质量问题-并非总是如此。为此,右键单击源,单击“编辑”,然后单击“错误输出”。转到使您感到悲伤的列,然后在“错误”下将其更改为“忽略失败”。