csv - 通过 SSIS 将 datetimeoffset 从 csv 文件导入表的问题

标签 csv ssis etl datetimeoffset flatfilesource

我有一个 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/

相关文章:

excel - 我想从 excel 导出格式化我的 csv 文件

ssis - SSIS脚本任务错误检索变量值

sql - SSIS 在查找转换中使用变量

sql-server - SSIS包如何在每次包运行时向文件名添加日期/时间戳

csv - 使用 awk 将各种新列添加到 CSV 文件

java - 在循环java中的多列中写入CSV

使用 numpy 中的加载文本导入 cdv 时出现 ' b ' 的 Python 问题

sql-server - 无法将 SSIS 包部署到 Windows 10 Pro 上的 SQL Server 2016 Express

sql - 使用 SSIS 和 SSMS - 尝试创建详细说明源列和目标列及其关系的 ETL 设计文档

json - Talend DB 到 JSON 输出文件