l5066113 说得很对。 以下是测试例子: 数据文件是c:\test.txt, 内容如下: abc|234|123|123 cde|111|2006-12-11|2007-11-13 数据结构如下: CREATE TABLE TEST2 ( A char(10), b integer, c date, d date ); 最后两个字段是日期型,我期望将数据123转换日期型的空值,Load脚本如下: LOAD TABLE test2 ( a '|', b '|', c '|' null('123'), d '\x0d\x0a' null('123') ) FROM 'c:\test.txt' ESCAPES OFF QUOTES Off format ASCII WITH CHECKPOINT ON;
如果你仅仅是从IQ卸载,再装入IQ,可以采用二进制方式卸载和装载,就完全避免了分隔符和空值等问题 --二进制方式导出数据 SET TEMPORARY OPTION temp_extract_directory='/upload/data'; SET TEMPORARY OPTION temp_extract_name1='test.bin'; SET TEMPORARY OPTION Temp_Extract_Append = 'OFF'; SET TEMPORARY OPTION Temp_Extract_Binary =ON; SELECT * from test.test; --SET TEMPORARY OPTION Temp_Extract_Name1 = ''; ---加载二进制数据 LOAD INTO TABLE WAP_CDR_DATA_FACT_test ( TIMEID BINARY WITH NULL BYTE , FILE_COLUMN_ID BINARY WITH NULL BYTE , CITY_ID BINARY WITH NULL BYTE , USER_BRAND_ID BINARY WITH NULL BYTE , CODE_ID BINARY WITH NULL BYTE , STATSTIME BINARY WITH NULL BYTE , MSISDN BINARY WITH NULL BYTE , TS_INCOMING_HTTP_REQ BINARY WITH NULL BYTE , TS_OUTGOING_HTTP_REQ BINARY WITH NULL BYTE , TS_INCOMING_HTTP_RESP BINARY WITH NULL BYTE , TS_OUTGOING_HTTP_RESP BINARY WITH NULL BYTE , TS_ACK_OR_ABORT BINARY WITH NULL BYTE , DURATION_TIME BINARY WITH NULL BYTE , URL BINARY WITH NULL BYTE , SP_DOMAIN BINARY WITH NULL BYTE , FILE_TYPE BINARY WITH NULL BYTE , SERVICE_TYPE BINARY WITH NULL BYTE , USER_AGENT_ORIGIN BINARY WITH NULL BYTE , USER_AGETN BINARY WITH NULL BYTE , SOFT_VERSION BINARY WITH NULL BYTE , HTTP_STATUS_CODE BINARY WITH NULL BYTE , HTTP_STATUS_SUBCODE BINARY WITH NULL BYTE , BEARER_TYPE BINARY WITH NULL BYTE , PROTOCAL_TYPE BINARY WITH NULL BYTE , CLIENT_ADDRESS BINARY WITH NULL BYTE , VOLUMESTREAM BINARY WITH NULL BYTE , WAPGW_IP BINARY WITH NULL BYTE , CDR_TYPE BINARY WITH NULL BYTE , PROVINCENODE_ID BINARY WITH NULL BYTE , MANUFACTURER_ID BINARY WITH NULL BYTE , SYSTEM_ID BINARY WITH NULL BYTE , SESSION_ID BINARY WITH NULL BYTE , GW_AVG BINARY WITH NULL BYTE , SP_AVG BINARY WITH NULL BYTE , FILE_NAME BINARY WITH NULL BYTE ) FROM '/upload/data/test.bin' QUOTES OFF ESCAPES OFF FORMAT binary;
[此贴子已经被作者于2007-1-10 10:08:37编辑过]
|