【DB2】How to EXPORT and IMPORT DB TABLE

How to IMPORT

Insert the contents of the external file into the table. If the insert table already has a record with the same primary key, that record will be overwritten.

DB2 "IMPORT FROM <<External file data name>> OF DEL INSERT_UPDATE INTO  <<TABLE name>>”

Delete everything in the insertion destination table and replace everything with the contents of the external file

DB2 "IMPORT FROM <<External file data name>> OF DEL REPLACE INTO  <<TABLE name>>” 

※ << External data file name >>: Specify the file name to be inserted in the table.
※ << TABLE name >>: Specify the table name of the insertion destination.

How to EXPORT

Outputs the entire contents of the table to an external file.

DB2 "EXPORT TO <<External file data name>> OF DEL SELECT * FROM <<TABLE name>>”

※<< External data file name >>: Please use any file name.
※<< TABLE name >>: Specify the table name you want to output externally.

If you want to output a part of the table,By specifying a condition instead of “SELECT * FROM << TABLE name >>”, you can output the data to be output to the outside according to the condition.

Follow me!

コメントする

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です