我有一个 csv 作为源文件,我试图将数据从此文件加载到阶段 SQL 服务器表。共有三个日期列。下面是这些列的值的示例:
2007-10-02T08:46:13+02:00
在 SQL 服务器端,我将 datetimeoffset(7)
定义为数据类型,并在 SSIS 连接管理器中选择了 database timestamp with timezone [DT_DBTIMESTAMPOFFSET]
作为数据类型。但是我在导入日期时间列时遇到以下错误:
Data conversion failed. The data conversion for column "column1" 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, Flat File Source [2]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Flat File Source.Outputs[Flat File Source Output].Columns[column1]" failed because error code 0xC0209084 occurred, and the error row disposition on "Flat File Source.Outputs[Flat File Source Output].Columns[column1]" 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: 0xC0202092 at Data Flow Task,
Flat File Source [2]: An error occurred while processing file "\path to file.csv" on data row 2. Error: 0xC0047038 at Data Flow Task, SSIS.Pipeline: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Flat File Source returned error code 0xC0202092. 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.
你知道怎么解决吗?或者为什么我会收到此错误?
最佳答案
首先尝试将其加载为字符串(长度为 25 左右),然后尝试使用 ssis 中的转换列对其进行子字符串化,然后您可以尝试将其转换为另一个转换列中的日期时间数据类型,然后再加载到您的表中。
关于csv - 通过 SSIS 将 datetimeoffset 从 csv 文件导入表的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57871328/