2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

DB import コマンド 目的別まとめ

Last updated at Posted at 2016-07-30

DB2 importコマンドの利用目的別にオプションの使い分けメモ。
以下、import.csv を sampleテーブルに登録する例

文字コード指定

modified by codepage=xxxxで指定

import from import.csv of del of del modified by codepage=1208 insert into sample

codepage=1208はUTF-8

改行付データ

modified by delprioritycharを利用。
字区切りの優先順位を変えてくれる。
デフォルト優先順位は、(1) レコード区切り文字、(2) 区切り文字、(3) 列区切り文字。
この修飾子を使用すると、区切り文字の優先順位が (1) 区切り文字、(2) レコード区切り文字、(3) 列区切り文字にとなる

import from import.csv of del of del modified by delprioritychar insert into sample

デフォルト値を利用

列のデフォルト値を設定する場合のオプション。
modified by usedefaultsを利用する。

import from import.csv of del of del modified by usedefaults insert into sample

identity列のimport

フィールドでidentity列を利用している場合※、Importファイルの内容に整合性がないとエラーになります。
※ddl ex. field1 int generated by default as identity

そんな時は、modified by identityignoreを指定すると、Importファイルの内容を無視して、 ID値を生成してくれます。

import from import.csv of del of del modified by identityignore insert into sample

コミット単位を指定する

アクティブログフルには要注意。

import from import.csv of del of del commitcount xxxxx modified by xxxx insert into sample
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?