添加新的转换列失败 [英] Failure in adding new transformed column

查看:34
本文介绍了添加新的转换列失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一个问题在这里:)

我正在处理一个项目,我只需要将员工表(ID、名字、姓氏)中的 3 列从数据库复制到 Excel 工作表目标,

I'm working on a project where i need to copy only 3 columns from Employee table (ID, Firstname, Lastname) from DB to an Excel worksheet destination,

我需要创建一个名为Seniority"的新列.

and i need to create new column that will be called "Seniority".

我想参加HireDate"活动(我曾考虑将其映射到所有员工的派生列转换)并将其转换为年资.

I was thinking to take the "HireDate" (I've thought to map it also for the derived column transformation) of all employees and transform it to years of seniority.

在派生列转换编辑器中,我输入了以下值:

In the Derived Column Transformation Editor i put these values:

派生列名称 - 资历

派生列 -

表达式 - (DT_I4) DATEDIFF( "YEAR", YEAR( [HireDate] ) , YEAR( GETDATE() ) )

Expression - (DT_I4) DATEDIFF( "YEAR", YEAR( [HireDate] ) , YEAR( GETDATE() ) )

并收到此错误:

数据流任务中的错误 [派生列 [234]]:函数约会"不支持数据类型DT_I4"对于参数号2. 无法将参数类型隐式转换为函数的兼容类型.要执行此操作,操作数需要使用转换运算符显式转换.

Error at Data Flow Task [Derived Column [234]]: The function "DATEDIFF" does not support the data type "DT_I4" for parameter number 2. The type of the parameter could not be implicitly cast into a compatible type for the function. To perform this operation, the operand needs to be explicitly cast with a cast operator.

数据流任务中的错误 [派生列 [234]]:评估函数约会"失败,错误代码 0xC0047089.

Error at Data Flow Task [Derived Column [234]]: Evaluating function "DATEDIFF" failed with error code 0xC0047089.

数据流任务中的错误 [派生列 [234]]:函数约会"不支持数据类型DT_I4"对于参数号2. 无法将参数类型隐式转换为函数的兼容类型.要执行此操作,操作数需要使用转换运算符显式转换.

Error at Data Flow Task [Derived Column [234]]: The function "DATEDIFF" does not support the data type "DT_I4" for parameter number 2. The type of the parameter could not be implicitly cast into a compatible type for the function. To perform this operation, the operand needs to be explicitly cast with a cast operator.

数据流任务中的错误 [派生列 [234]]:计算表达式 "(DT_I4) DATEDIFF( "YEAR", YEAR( [HireDate] ) , YEAR(GETDATE() ) )"失败,错误代码 0xC00470C5.表达式可以存在解析时无法检测到的错误,例如除以零时间,否则可能会出现内存不足错误.

Error at Data Flow Task [Derived Column [234]]: Computing the expression "(DT_I4) DATEDIFF( "YEAR", YEAR( [HireDate] ) , YEAR( GETDATE() ) )" failed with error code 0xC00470C5. The expression may have errors, such as divide by zero, that cannot be detected at parse time, or there may be an out-of-memory error.

数据流任务中的错误 [派生列 [234]]:表达式"(DT_I4) DATEDIFF( "YEAR", YEAR( [HireDate] ) , YEAR( GETDATE() ))"在派生列.输出[派生列输出].Columns[Seniority]"无效.

Error at Data Flow Task [Derived Column [234]]: The expression "(DT_I4) DATEDIFF( "YEAR", YEAR( [HireDate] ) , YEAR( GETDATE() ) )" on "Derived Column.Outputs[Derived Column Output].Columns[Seniority]" is not valid.

数据流任务中的错误 [派生列 [234]]:无法设置属性表达"在派生列.输出[派生列输出].Columns[Seniority]".

Error at Data Flow Task [Derived Column [234]]: Failed to set property "Expression" on "Derived Column.Outputs[Derived Column Output].Columns[Seniority]".

(微软 Visual Studio)

(Microsoft Visual Studio)

请帮忙.

谢谢,

推荐答案

函数 YEAR([HireDate]) 返回一个 DT_I4(四字节有符号整数),但 DATEDIFF 函数需要两个日期作为参数.所以表达式

The function YEAR([HireDate]) returns an DT_I4(four-byte signed integer) but the DATEDIFF function needs two dates as parameters. So the expression

DATEDIFF("YEAR",[HireDate],GETDATE())

返回所需的结果.

这篇关于添加新的转换列失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆