gpt4 book ai didi

sql-server - SSIS 日期转换不断抛出错误 String->DBDATE

转载 作者:行者123 更新时间:2023-12-02 03:39:58 25 4
gpt4 key购买 nike

我目前正在开发一个 SSIS 项目,我从 .csv 文件导入,其中包含日期等。日期格式为 yyyy-mm-dd,并且在文件连接预览中也如此读取。然后,我进行数据转换,分配一个新列以将数据用作 DBDATE 类型。原始数据采用 WSTR(Unicode 字符串)格式,大小为 10。然后,我在数据转换时出现以下错误:

Error: 0xC02020C5 at Data Flow Task, Data Conversion [2]: Data conversion failed while converting column "Leverdatum" (25) to column "NewLeverdatum" (8).  The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".

Error: 0xC0209029 at Data Flow Task, Data Conversion [2]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Data Conversion.Outputs[Data Conversion Output].Columns[NewLeverdatum]" failed because error code 0xC020907F occurred, and the error row disposition on "Data Conversion.Outputs[Data Conversion Output].Columns[NewLeverdatum]" 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 Data Flow Task, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Data Conversion" (2) failed with error code 0xC0209029 while processing input "Data Conversion 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.

该项目的语言为英语(美国)。我还尝试在我的计算机上使用本地日期格式,即 dd-mm-yyyy。请告诉我如何将此列导入为日期。

我尝试过使用派生列而不是数据转换,并且我还尝试将列的类型直接设置为 DBDATE。

提前致谢。

编辑:目前可以将数据导入为任务,因为数据将导出到 Excel,这将识别文本形式的日期。如果有人有答案,仍然希望得到答案

最佳答案

DT_DBDATE 格式需要 yyyy-mm-dd

我相信您的新列是 NewLeverdatum,而您的旧列 DT_WSTRLeverdatum

基于错误

Error: 0xC02020C5 at Data Flow Task, Data Conversion [2]: Data conversion failed while converting column "Leverdatum" (25) to column "NewLeverdatum" (8). The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".

它失败了,因为DT_DBDATE将导致10个字符的日期与破折号 -

更改您的 Leverdatum 列以允许 len = 10

关于sql-server - SSIS 日期转换不断抛出错误 String->DBDATE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58603447/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com