2016-10-18 42 views
0

我從記事本(.txt)文件中的sysssislog表中獲取數據,並且需要將數據傳輸到SQL服務器數據庫中。如何將文本文件中的數據傳輸到數據庫中

我在sql server中創建了表。數據應該使用SSIS包在表中傳輸。在工作中出現了這個錯誤。

有誰知道如何解決它?非常感謝

SSIS packages scheme

[OLE DB Destination [113]] 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: "Violation of PRIMARY KEY constraint 'PK__sysssisl__3213E83F530E2571'. Cannot insert duplicate key in object 'dbo.sysssislog'. The duplicate key value is (0).".

[OLE DB Destination [113]] Error: SSIS Error Code

DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "OLE DB Destination.Inputs[OLE DB Destination Input]" failed because error code 0xC020907B occurred, and the error row disposition on "OLE DB Destination.Inputs[OLE DB Destination Input]" 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_PROCESSINPUTFAILED. The ProcessInput method on component "OLE DB Destination" (113) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (126). 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.

[Flat File Source [56]] Error: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.

[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Flat File Source which returns error code 0xC02020C4. 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.

回答

2

SSIS消息有時被混淆,因爲它看起來像有更多的錯誤不是真的有。在這種情況下,第一個錯誤是關鍵:Violation of PRIMARY KEY constraint所有其他錯誤都讓您知道至少有一個錯誤阻止任務完成。

檢查您的映射並確保您沒有將重複值輸入到您爲該表設置的任何主鍵中。

0

您可以使用BCP將數據導入到SQL Server數據庫:

下面是從文件導入數據的簡單命令:

C:\example.txt into table dbo.example.

bcp dbo.example in 'C:\example.txt' -T -SserverName\instanceName

+0

謝謝bassrek,我解決了這個問題。當然,我會嘗試使用BCP,非常感謝 – RInfo

相關問題