【问题标题】:[Derived Column [40]] Error: An error occurred while attempting to perform a type cast[派生列 [40]] 错误:尝试执行类型转换时出错
【发布时间】:2012-08-29 20:17:40
【问题描述】:

我已经在 Sql Server 中使用 IsNull 条件编写了日期和时间列查询.. 我在下面提到了该查询..

我想要的查询是,如何编写 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.

【问题讨论】:

  • 我的猜测是一些无效数据。您可以将错误的行重定向到某个文件并检查导致问题的原因。

标签: sql-server-2008 ssis


【解决方案1】:

我想你正在寻找:

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 一样填写日期部分。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-09
    • 1970-01-01
    • 1970-01-01
    • 2022-08-15
    • 1970-01-01
    • 2019-06-25
    相关资源
    最近更新 更多