[code]LOAD TABLE [ owner ].table-name[ ( load-specification, ... ) ]FROM ‘filename-string‘, ...[ FORMAT { ‘ascii‘ | ‘binary‘ } ]... [ DELIMITED BY string ]... [ STRIP { ON | OFF } ]... [ QUOTES { ON | OFF } ]... [ ESCAPES { ON | OFF } ][ ESCAPE CHARACTER character ] [ WITH CHECKPOINT ON|OFF ]... [ load-options ][/code]
下面是从一个文本文件load到表F_INN_IA_DAILY_SUM中的语句:
set temporary option date_order=YMD;Load Table F_INN_IA_DAILY_SUM(ORG_SID ‘+|+‘, DEAL_SID ‘+|+‘, ALL_TIME_SID ‘+|+‘, R_COUNT_DIM_SID ‘+|+‘, T_TAX_STOR_COST ‘+|+‘, T_STOR_COST ‘+|+‘, T_STOR_SUM ‘+|+‘, CREATED_DT ‘X0A‘)From ‘/load_data/F_Inn_IA_Daily_Sum.txt‘ESCAPES OFFQUOTES OFFNOTIFY 100000WITH CHECKPOINT ON;COMMIT
其中+|+是字段的分隔符,X0A是记录的分隔符,即回车(文本文件中)。
例一:
1,文本文件的内容格式为:
abc|defgh|aaaa|bbbbbb|ccccc|ddddd|eeee|fffFabc|defgh|aaaa|bbbbbb|ccccc|ddddd|eeee|fffF abc|defgh|aaaa|bbbbbb|ccccc|ddddd|eeee|fffF
2,load table语句:
Load table My_Table(ORG_SID ‘|‘, DEAL_SID ‘|‘, ALL_TIME_SID ‘|‘, R_COUNT_DIM_SID ‘|, T_TAX_STOR_COST ‘|‘, T_STOR_COST ‘|‘, T_STOR_SUM ‘|‘, CREATED_DT ‘X0A‘ --数据文件中每行的换行符(16进制))From ‘/load_data/loadTest.txt‘ ---要加载文件的路径ESCAPES OFFQUOTES OFFNOTIFY 100000WITH CHECKPOINT ON;COMMIT;
文件以‘|’作为分隔符,每行的换行符以 ‘X0A‘换行; 通常的换行有‘x0dx0a‘(回车、换行) 或‘x0A‘ (换行);
load table 语法写入存储过程,然后直接调用存储过程文件即可加载入库;
例二:
1,文本格式为:
20171222|&@001731edae78|&@absent|&@absent|&@001731edae78|&@|20171222|&@001bb958bc07|&@absent|&@absent|&@001bb958bc07|&@|20171222|&@001bfc067636|&@absent|&@absent|&@001bfc067636|&@|
2,load table 语句:
set temporary option CONVERSION_ERROR = ‘OFF‘; load table t_station_match_result(load_dt ‘|&@‘ null(‘//xd0‘),op_station ‘|&@‘ null(‘//xd0‘),ip ‘|&@‘ null(‘//xd0‘),mac ‘|&@‘ null(‘//xd0‘), mobile ‘|&@|‘ null(‘‘) )FROM ‘" + file_path+"‘ESCAPES OFFQUOTES OFF NOTIFY 100000 WITH CHECKPOINT ON;
file_path:txt文件路径(绝对路径)
Sybase中的load table的用法
标签:mobile com option upd 文件 bfc 内容 name 文件路径
小编还为您整理了以下内容,可能对您也有帮助:
sybase中load table什么意思
load in
set temporary option CONVERSION_ERROR = 'OFF';
LOAD TABLE dba.table01
(s1 '|',s2 '|',s3 '\x0a') from
'/home/a.txt'
escapes off
quotes off
notify 100000
Ignore Constraint ALL 5000000
Message Log '/home/error/msg_0203.log'
Row Log '/home/error/error_0203.log'
only log ALL
Log Delimited By '|'
with checkpoint on;
commit;
load out
set temporary option Temp_Extract_Column_Delimiter = '|';
set temporary option Temp_Extract_Name1 = '/home/sybiq/error/out_iq.txt';
select *
from table01;
set temporary option Temp_Extract_Name1 = '';
LOAD TABLE 语句
说明将数据从外部 ASCII 格式文件导入数据库表。
语法LOAD [ INTO ] TABLE [ owner ].table-name
... ( load-specification [, ...] )
... FROM { 'filename-string' | filename-variable } [, ...]
... [ CHECK CONSTRAINTS { ON | OFF } ]
... [ DEFAULTS { ON | OFF } ]
... QUOTES OFF
... ESCAPES OFF
... [ FORMAT { 'ascii' | 'binary' } ]
... [ DELIMITED BY 'string' ]
... [ STRIP { ON | OFF } ]
... [ WITH CHECKPOINT { ON | OFF } ]
... [ { BLOCK FACTOR number | BLOCK SIZE number } ]
... [ BYTE ORDER { NATIVE | HIGH | LOW } ]
... [ LIMIT number-of-rows ]
... [ NOTIFY number-of-rows ]
... [ ON FILE ERROR { ROLLBACK | FINISH | CONTINUE} ]
... [ PREVIEW { ON | OFF } ]
... [ ROW DELIMITED BY 'delimiter-string' ]
... [ SKIP number-of-rows ]
... [ WORD SKIP number ]
... [ START ROW ID number ]
... [ UNLOAD FORMAT ]
... [ IGNORE CONSTRAINT constrainttype [, ...] ]
... [ MESSAGE LOG ‘string’ ROW LOG ‘string’ [ ONLY LOG logwhat [, ...] ]
... [ LOG DELIMITED BY ‘string’ ]
求助,在SYBASE IQ中怎么用loca table 向表中导数据
message 'load table t1' type info to client ;
LOAD TABLE t1
(
id '|!' ,
name '\x0a'
)
FROM 'c:\t1.dat'
FORMAT ASCII
STRIP ON
ESCAPES OFF
QUOTES OFF
NOTIFY 500000
WITH CHECKPOINT ON;
COMMIT;
sybase iq数据库 insert into select 数据量大时报错
你这个情况主要是缓存不够,所以用存储过程的话那还是一个样子的;解决的方法要么是分批导,要么是估计是要配置一下数据库服务器的内存,把数据库服务器关于缓存这块的内存分配的大些估计可以,数据库服务器里的一些参数也应该优化一下。