【发布时间】:2020-03-11 17:43:18
【问题描述】:
我在 SSIS 包中有一个数据流任务,该任务将数据从平面文件加载到表中。
在源数据中,有一个格式为 DD/MM/YYYY 的日期列,我正在尝试将其转换为 YYYY-MM-DD 并将其转换为日期。我的派生列任务中的表达式是:
(DT_DATE)(SUBSTRING(SaleDate,7,4) + "-" + SUBSTRING(SaleDate,4,2) + "-" + SUBSTRING(SaleDate,1,2))
但是此任务失败并出现以下错误:
Error: 0xC0049064 at Load into Staging, Derived Column [2]: An error occurred while attempting to perform a type cast.
Error: 0xC0209029 at Load into Staging, Derived Column [2]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Derived Column" failed because error code 0xC0049064 occurred, and the error row disposition on "Derived Column.Outputs[Derived Column Output].Columns[SaleDate2]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
Error: 0xC0047022 at Load into Staging, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Derived Column" (2) failed with error code 0xC0209029 while processing input "Derived Column Input" (3). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
Error: 0xC02020C4 at Load into Staging, Flat File Source [12]: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.
Error: 0xC0047038 at Load into Staging, SSIS.Pipeline: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Flat File Source returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
这是我的表达式编辑器:
我知道这可能是一个很常见的问题,但在寻找答案时我没有找到任何帮助。
我是否遗漏了一些明显的东西?
【问题讨论】:
-
我通常使用脚本组件和.Net DateTime.ParseExact 方法
-
@Piotr 你能说得更详细一点吗?我以前从未在 SSIS 中使用过脚本
标签: sql-server tsql ssis