2012-08-29 63 views
0

我已經在Sql Server中使用IsNull條件編寫日期和時間列查詢..我在下面提到了該查詢..[Derived Column [40]]錯誤:嘗試執行類型轉換時發生錯誤

我想這個查詢是,如何編寫ssis派生列。我已經在ssis中寫入了該查詢,但是某些投射類型錯誤來了。

此處連接日期和時間列。

請幫幫我,

SQL查詢---

CAST(ISNULL(CONVERT(Nvarchar(10),InitialDate,101), '01/01/1900') AS Nvarchar(10))+ ' ' + ISNULL(CONVERT(NVarChar(8),InitialTime,108), '00:00:00') as CourtDttm 

SSIS派生列

(DT_DBTIMESTAMP)((DT_STR,255,1252)(ISNULL(InitialDate) ? ((DT_DBTIMESTAMP)"01/01/1900") : (InitialDate)) + " " + 
((DT_STR,255,1252)(ISNULL(InitialTime) ? ((DT_DBTIMESTAMP)"00 : 00 : 00") : (InitialTime)))) 


Errors --[Derived Column [40]] Error: An error occurred while attempting to perform a type cast. 
+0

我的猜測是一些無效的數據。您可以將錯誤的行重定向到某個文件,並檢查導致問題的原因。 – kyooryu

回答

0

我認爲你正在尋找:

DT_DBDATE - A date structure that consists of year, month, and day. 

DT_DBTIME - A time structure that consists of hour, minute, and second. 

如果你使用DT_DBTIMESTAMP,你必須像你爲InitialDate所做的那樣填寫日期部分。