I have here a running IBM DB2 Database. I would like to export data from some tables into an SQL-Insert Skript, for example for the table T1 with the following content:

| Col1 | Col2 | 
|    1 | Foo  |
|    2 | Bar  |

A script like

INSERT INTO T1 (Col1, Col2) VALUES(1, 'Foo');
INSERT INTO T1 (Col1, Col2) VALUES(2, 'Bar');

should be generated. The tables I would like to export do not have any auto-generated columns, so no special logic to treat those separately is necessary.

I've been using IBM Data Studio Client to export a DDL, examine the data, etc., but I did not find any export functions to export into an SQL-INSERT Script (there are functions to export into a CSV, etc.).

Can someone please give me some hints about a tool that could do this job, or tell me where in IBM Data Studio I could do this export?

1 Answer 1


With current versions of DB2 for Linux/Unix/Windows, such a function is not available. That is for a good reason. It is significantly safer and faster to export to a flat file (or an IXF file) and then LOAD or IMPORT or INGEST that file if the purpose is to copy data between databases or RDBMS systems. You can also use load-from-cursor to copy content between DB2 tables. If you have a tiny number of rows in the table then creating the INSERT statements row by row is OK, but you would need to code that yourself, or use a third party tool (not supplied with raw DB2 LUW ) for that purpose.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .