SSIS 将日期时间列导入 SQL Server 2008 [英] SSIS importing datetime column into SQL Server 2008
问题描述
我正在尝试使用 SSIS 将 PSV 文件导入 SQL Server 2008.
I am trying to import a PSV file into SQL Server 2008 using SSIS.
除了一个包含 datatime
的字段外,一切正常.
All is working fine apart from one field that contains a datatime
.
正在导入的文件内容包含格式为
The contents of the file being imported contains datetime in the format of
2012-08-08T13:31:28.170
PSV 文件的文件连接器设置是精确的数据库时间戳 [DT_DBTIMESTAMP2]
The file connector settings, for the PSV file are database timestamp with precision [DT_DBTIMESTAMP2]
SQL Server 中的目标列具有 datetime
数据类型.
The destination column in SQL Server has a datetime
datatype.
SQL 表的包/内容的结果是日期时间导入:
The result of the package / contents of the SQL table is a datetime import:
2012-08-08 00:00:00.000
您会注意到尚未导入分钟/秒.
You will notice that the mins/secs have not been imported.
我一定使用了错误的日期时间格式,但似乎尝试了所有组合都没有成功.
I must be using the wrong datetime formats, but seemed to have tried all combinations with no success.
谁能指出我正确的方向?
Can anyone point me in the right direction ?
推荐答案
我曾经遇到过类似的情况,问题出在我的源上,而不是目标上.
I had a similar situation once where the problem was on my source, not on the destination.
我建议您通过右键单击 SourceComponent 上的字段来检查它,选择显示高级编辑器 -> 输入和输出属性 -> 展开输出列"-> 选择您的列并更改为正确的数据类型(通常是 [DT_DBTIMESTAMP] 对我来说很好).同样为了测试,在输出列"上做同样的事情
I suggest you to check the field on the SourceComponent by right clicking it, selecting Show Advanced editor -> imput and Output properties -> Expand "Output columns" -> Slect your column and change to the propper data type (usually [DT_DBTIMESTAMP] works fine for me). Also for the sake of testing, do the same on "Output columns"
这篇关于SSIS 将日期时间列导入 SQL Server 2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!