且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从平面文件导入SQL数据库时的日期格式问题

更新时间:2023-08-24 09:44:04

这个问题很常见,我遇到了很多次。

This issue is common and I have encountered it many times.

首先,检查您的SSIS区域设置是否未设置为美国。

您需要将其设置为英文(United Kindom)或荷兰(荷兰)。

要执行此操作,请单击SSIS包中的任意位置并查看属性并设置LocaleID(在Misc下)。在连接管理器中,选择flat_source_file连接并编辑属性面板中的LocaleID。
如果没有帮助,那么请执行以下操作:

First thing, check if your SSIS Locale is not set to United States.
You need to set it to English(United Kindom) or Dutch (Netherlands).
To do that click anywhere in your SSIS package and view properties and set LocaleID (under Misc). In Connection Managers, select the flat_source_file Connection and edit the LocaleID in the properties panel. If that doesn't help then do the following:

我将平面文件源中的源列设置为字符串数据类型。

然后使用数据转换转换将日期列转换为 DT_DATE DT_DBDate

I would set the source column in your 'Flat File Source' to string datatype.
Then use a 'Data Conversion' transformation to cast the date column as either DT_DATE or DT_DBDate.

DT_DATE 是一个日期结构包括年,月,日和小时。

DT_DBDATE 是一个包含年,月和日的日期结构。 />

DT_DATE is a date structure that consists of year, month, day, and hour.
DT_DBDATE is a date structure that consists of year, month, and day.

现在在目标窗口中使用新的转换列。

Now use the new transformed column in the destination window.