说明:
TIMESTAMP FORMAT : 用 来 指 定 timestamp 列 的 默 认 格 式 , 如’%Y-%m-%d %H:%i:%s.%f’
建表语句:
create table ttimestamp(a timestamp default '2014-01-01 12:25:36' ,b int);
数据文件:
2014-01-01 12:01:01|1
|2
|3
|4
|5
2014-01-02 12:03:03|6
加载过程:
gbase> LOAD DATA INFILE ‘http://10.10.120.226/timestamp.txt’ INTO TABLE
test.ttimestamp DATA_FORMAT 3 FIELDS TERMINATED BY '|' TIMESTAMP FORMAT
'%Y-%m-%d %H:%i:%s';
Query OK, 6 rows affected
Task 2 finished, Loaded 6 records, Skipped 0 records
查询入库数据:
select * from ttimestamp order by b
+---------------------+------+
| a | b |
+---------------------+------+
| 2014-01-01 12:01:01 | 1 |
| 2014-01-01 12:25:36 | 2 |
| 2014-01-01 12:25:36 | 3 |
| 2014-01-01 12:25:36 | 4 |
| 2014-01-01 12:25:36 | 5 |
| 2014-01-02 12:03:03 | 6 |
+---------------------+------