我是ssis的新手,我想使用表达式生成器来评估它,以获得bigin中的当前日期。有什么想法吗?
DATEPART(second, getdate()) +
DATEPART(minute, getdate()) * 100 +
DATEPART(hour, getdate()) * 10000 +
DATEPART(day, getdate()) * 1000000 +
DATEPART(month, getdate()) * 100000000 +
DATEPART(year, getdate()) * 10000000000错误是
无法计算表达式。
------------------------------
ADDITIONAL INFORMATION:
The expression contains unrecognized token "second". If "second" is a variable, it should be expressed as "@second". The specified token is not valid. If the token is intended to be a variable name, it should be prefixed with the @ symbol.
Attempt to parse the expression "DATEPART(second, getdate()) +
DATEPART(minute, getdate()) * 100 +
DATEPART(hour, getdate()) * 10000 +
DATEPART(day, getdate()) * 1000000 +
DATEPART(month, getdate()) * 100000000 +
DATEPART(year, getdate()) * 10000000000" failed and returned error code 0xC00470A4. The expression cannot be parsed. It might contain invalid elements or it might not be well-formed. There may also be an out-of-memory error.
(Microsoft.DataTransformationServices.Controls)
------------------------------发布于 2020-06-12 03:37:24
SSIS表达式中的DATEPART语法与TSQL中的语法不同。因为这会让我们的生活变得更加艰难。
第一个参数datepart必须用双引号括起来。这应该会让你更接近你想要的。
DATEPART("second", getdate()) +
DATEPART("minute", getdate()) * 100 +
DATEPART("hour", getdate()) * 10000 +
DATEPART("day", getdate()) * 1000000 +
DATEPART("month", getdate()) * 100000000 +
DATEPART("year", getdate()) * 10000000000您将得到的下一个错误是:
文字"10000000000“太大,无法放入类型DT_I4中。文字的大小会使类型溢出。
您可以通过在最后一个文字的末尾添加一个L来解决这个问题:
DATEPART("second", getdate()) +
DATEPART("minute", getdate()) * 100 +
DATEPART("hour", getdate()) * 10000 +
DATEPART("day", getdate()) * 1000000 +
DATEPART("month", getdate()) * 100000000 +
DATEPART("year", getdate()) * 10000000000L并正确评估为20200611143622。
https://stackoverflow.com/questions/62327258
复制相似问题