2011-06-21 40 views
0

我有這個SSIS包昨天工作,現在我得到這個錯誤,沒有改變過夜。SSIS 2008:派生列將字符串轉換爲日期數據類型

基本上我得到的字符串看起來像:yyyymmdd,我需要將其轉換爲日期數據類型。所以我採取子串,得到yyyy/mm/dd然後把它轉換成日期類型。

的路徑:

平面文件源---> Dervied列---「我所有的SSIS包一體化/插入任務

這裏有表達式:

(DT_DATE)(SUBSTRING([PolicyExpire],1,4) + "/" + SUBSTRING([PolicyExpire],5,6) + "/" + SUBSTRING([PolicyExpire],7,8)) 
(DT_DATE)(SUBSTRING([BirthDate],1,4) + "/" + SUBSTRING([BirthDate],5,6) + "/" + SUBSTRING([BirthDate],7,8)) 
(DT_DATE)(SUBSTRING([DLIssueDate],1,4) + "/" + SUBSTRING([DLIssueDate],5,6) + "/" + SUBSTRING([DLIssueDate],7,8)) 

這是錯誤:

Error: 0xC0049064 at Extract EXD data from Flatfile into YD db 1, Derived Column [3352]: An error occurred while attempting to perform a type cast.

Error: 0xC0209029 at Extract EXD data from Flatfile into YD db 1, Derived Column [3352]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "component "Derived Column" (3352)" failed because error code 0xC0049064 occurred, and the error row disposition on "input column "PolicyExpire" (3368)" 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.

Error: 0xC0047022 at Extract EXD data from Flatfile into YD db 1, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Derived Column" (3352) failed with error code 0xC0209029 while processing input "Derived Column Input" (3353). 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

據推測,你試圖導入的數據今天是不同的。你今天的文本文件數據源有問題嗎?

+0

是的,這是事實。謝謝您的幫助。 –

0

上面的轉換不考慮NULL。檢查[PolicyExpire]是否在其中一條記錄中有一個NULL值。

1

您的子字符串參數在日期的月份和日期部分不正確。

例如,它應該是

SUBSTRING([PolicyExpire],5,2

代替

SUBSTRING([PolicyExpire],5,6-) 到獲取月份值。

子字符串函數的第三個參數是要查找的子字符串的LENGTH(在本例中爲2),而不是子字符串的END POSITION。

試試這個

(DT_DATE)(SUBSTRING([PolicyExpire],1,4) + "/" + SUBSTRING([PolicyExpire],5,2) + "/" + SUBSTRING([PolicyExpire],7,2)) 

(DT_DATE)(SUBSTRING([BirthDate],1,4) + "/" + SUBSTRING([BirthDate],5,2) + "/" + SUBSTRING([BirthDate],7,2)) 

(DT_DATE)(SUBSTRING([DLIssueDate],1,4) + "/" + SUBSTRING([DLIssueDate],5,2) + "/" + SUBSTRING([DLIssueDate],7,2)) 
相關問題