2012-08-29 62 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所做的那样填写日期部分。