导入文件到db2数据库

create table markets(
shangpin varchar(20),
yiyue varchar(20),
eryue varchar(20),
sanyue varchar(20)

)

//以便将插入语句中的20行记录作为一组一起导入

import from e:\demo.csv of del modified by compound =20 insert into markets;

//codepage设置导入数据的编码(1208是GBK,1386是UTF-8)

import from e:\demo.csv of del modified by codepage=1386 insert into markets;

//提交行数,多少行记录做一次提交动作

import from e:\demo.csv of del commitcount 20 insert into markets;

//replace先删除表的记录,然后再添加

load from e:\demo.csv of del modified by codepage=1386 replace into markets;

//method P导入的字段

load from e:\demo.txt of del modified by codepage=1386 method P(1, 2, 4)  replace into markets(shangpin,yiyue,sanyue);
//存在自动增长的导入
load from e:demo1.csv of del modified by identityignore insert into markets;
export to e:\test.xls of del select * from markets;
insert into markets values('测试','1','2','3')
select * from markets;
select count(*) from markets

你可能感兴趣的:(db2)