- 增加数据Import from aaa.del of del messages msg.out insert into productImport from aaa.del of del messages msgout insert into product(price,prod_no,description)2. 更新已经存在的数据及加入新数据Import from aaa.del of del messages msg.out replace into product3. 替换数据Import from aaa.del of del messages msg.outreplace_create into product4. 创建表Import from aaa.ixf of ixf messages msg.outreplace_create into product5. commitcount与restartcount选项import from myfile.ixf of ixfcommitcount 500 messages msg.out insert into newtableimport from myfile.ixf of ixfcommitcount 50 restartcount 2000 messages msg.out insert into newtable6. 导入大对象
例一:Export to myname.del of del select * from myname
格式:export to x.ixf of ixf … select * from X…例二db2 export to org.del of del modified by chardel! coldel@ codepage=1208 select * from org字符串由感叹号!括起来,列由@号定界,字符串被转换成代码页1208例二db2 export to org.del of del modified by chardel! coldel@ codepage=1208 messages msg.out select * from org字符串由感叹号!括起来,列由@号定界,字符串被转换成代码页1208,添加message参数后,产生一个msg.out文件,捕获导出期间错误,警告和信息性消息。例三导出大对象Export to file_name of file_type lobs to lobfile_directory,lobfile_directory_2,….LobfilelobfilenameModified by lobsinfileselect_statment有了lobsinfile修饰符,export实用程序就查找lobs to 子句中指定的目录,然后将lob数据放在那里。如果没有找到lobs to 子句,就将lob数据发送到当前工作目录。例四CONNECT TO SAMPLE;EXPORT TO "E:/db2log/org.ixf" OF IXF METHOD N (DEPTNUMB, DEPTNAME) MESSAGES "E:/db2log/msg.out" SELECT * FROM ADMINISTRATOR.ORG;CONNECT RESET;例五CONNECT TO SAMPLE;EXPORT TO "E:/db2log/org1.ixf" OF IXF MESSAGES "E:/db2log/msg1.out" SELECT * FROM ADMINISTRATOR.ORG;CONNECT RESET;