【发布时间】:2013-02-01 16:15:44
【问题描述】:
下午好,
我有一个我无法弄清楚的两难境地。我正在尝试在 SQL 数据库表中导入平面文件,但遇到了问题。我在 SQL 中的列是出生日期 DOB 的日期时间列。提供给我的提取平面文件将此列作为日期...因此当我导入 SQL 时,我得到:
Messages
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Invalid date format".
(SQL Server Import and Export Wizard)
Error 0xc020901c: Data Flow Task 1: There was an error with input column "DOB" (212) on input "Destination Input" (147). The column status returned was: "Conversion failed because the data value overflowed the specified type.".
(SQL Server Import and Export Wizard)
Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (147)" failed because error code 0xC020907A occurred, and the error row disposition on "input "Destination Input" (147)" 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.
(SQL Server Import and Export Wizard)
我试图弄清楚如何在平面文件中的每个 DOB 中添加一个随机时间,例如 00:00:00.000。例如,他们发送给我 1983-11-30 但我想使用 1983-11-30 00:00:00.000
有没有办法做到这一点,或者有人知道我能做什么吗?提前致谢
【问题讨论】:
-
这不应该是一个问题(至少,不是你想的那个)。
DATETIME列将自动假定时间为00:00:00.000,而它只接收日期。这里最可能的问题是日期格式,SQL Server 可能假设您的日期格式是YYYY-DD-MM而不是YYYY-MM-DD -
在运行批量插入之前尝试执行
SET DATEFORMAT ymd。 -
谢谢您....我认为我的问题在其他地方...我只运行了一次,格式保持不变,并且假设为 0,就像您想的那样。谢谢
标签: sql sql-server import