2016-12-29 63 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。

相關問題