简体   繁体   English

db2时间戳格式未加载

[英]db2 timestamp format not loading

I am trying to bulk-load data with timestamps into DB2 UDB version 9 and it is not working out. 我正在尝试将带有时间戳的数据批量加载到DB2 UDB版本9中,但它无法正常运行。

My target table has been created thusly 我的目标表已经创建了

CREATE TABLE SHORT
(
 ACCOUNT_NUMBER INTEGER 
, DATA_UPDATE_DATE TIMESTAMP DEFAULT current timestamp
, SCHEDULE_DATE TIMESTAMP DEFAULT current timestamp
...
0)

This is the code for my bulk load 这是我的批量加载的代码

load from /tmp/short.csv of del modified by COLDEL, savecount 500 messages /users/chris/DATA/short.msg INSERT INTO SHORT NONRECOVERABLE DATA BUFFER 500

No rows are loaded. 没有加载任何行。 I get an error 我收到一个错误

SQL0180N  The syntax of the string representation of a datetime value is 
incorrect.  SQLSTATE=22007

I tried forcing the timestamp format when I create my table thusly: 因此我在创建表时尝试强制使用时间戳格式:

CREATE TABLE SHORT
(
 ACCOUNT_NUMBER INTEGER 
, DATA_UPDATE_DATE TIMESTAMP DEFAULT 'YYYY-MM-DD HH24:MI:SS' 
, SCHEDULE_DATE TIMESTAMP DEFAULT 'YYYY-MM-DD HH24:MI:SS' 
...
0)

but to no avail: SQL0574N DEFAULT value or IDENTITY attribute value is not valid for column . 但无济于事: SQL0574N DEFAULT value or IDENTITY attribute value is not valid for column Timestamp format in source my data file looks like this 源我的数据文件中的时间戳格式如下所示

2002/06/18 17:11:02.000

How can I format my timestamp columns? 如何格式化我的时间戳列?

Use the TIMESTAMPFORMAT file type modifier for the LOAD utility to specify the format present in your data files. 使用LOAD实用程序的TIMESTAMPFORMAT文件类型修饰符指定数据文件中存在的格式。

load from /tmp/short.csv
    of del
    modified by COLDEL, TIMESTAMPFORMAT="YYYY/MM/DD HH:MM:SS.UUUUUU"
    savecount 500 
    messages /users/chris/DATA/short.msg 
    INSERT INTO SHORT 
    NONRECOVERABLE

It almost looks like ISO to me. 它对我来说几乎像ISO。 If you are able to edit the data file and can safely change the slashes to hyphens, (maybe clip the decimal fraction) and DB2 accepts ISO, you're home. 如果您能够编辑数据文件并且可以安全地将斜杠更改为连字符(可能会剪切小数部分)并且DB2接受ISO,那么您就回家了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM