2016-12-29 64 views
0

我正在为Visual Studio 2013和SQL Server 2014使用SSDT。我正在使用Excel源和OLE DB目标将数据从Excel电子表格导入SQL Server表。我在OLE DB目标上得到这个String or binary data would be truncated.错误。我检查了所有内容,并且没有VARCHAR字段超过255,并且在Excel连接字符串中使用IMEX = 1。我试图一次导入一个字段进行测试,并且仍然得到相同的错误,并且不确定那个列。使用SSIS的SQL Server和Excel电子表格数据导入问题

SSIS错误:

[OLE DB Destination [28]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "The statement has been terminated.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "String or binary data would be truncated.".

[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "OLE DB Destination" (28) failed with error code 0xC0202009 while processing input "OLE DB Destination Input" (59). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.
There may be error messages posted before this with more information about the failure.

+0

你看到的和你得到的东西并不总是与Excel相同,将数据导出到文本文件,将其导回到新的Excel文件中。确保不仅要截断文本列,还要确保您的数字撤销在目标上是正确的或更大的。和往常一样,当使用Excel ...祝你好运。这就是为什么我将它作为瘟疫避免并总是用文本文件替代的原因。 –

+0

我不得不迫使它以前的工作,只需将字段设置为3000或其他巨大的东西,然后执行一对长度的命令来查找数据长度并再次尝试。 –

+0

Excel文件中的某个位置对于数据库表中的列来说太长。没有简单的内置方式来找到它。只是试验和错误。 –

回答

0

如果一次导入一个字段,即出现了错误应该是有问题的列的字段。 我所经历的是excel文件在字段中引用(“”)或特殊字符,并且在加载到SQL表中时将两个字段组合为一个字段。 因此,我将excel文件保存为CSV并导入CSV。

相关问题