IMPORT CLPPlus command

The IMPORT CLPPlus command is supported from a remote CLPPlus client where the import file is processed on the same client.

Invocation

You must run the IMPORT command from the CLPPlus interface.

Authorization

None

Required connection

You must be connected to a database.

Restrictions

  • The parameters that are available for the IMPORT command in the CLPPlus interface are a subset of the parameters that are available for the IMPORT command in the CLP interface.
  • Data can be imported only from a delimited file. The delimited file can be of any file type, such as: .del, .ixf, or .txt. The , character is the default delimiter. You can set the delimiter to another character by using the SET CLPPlus command.
  • The target database table cannot be a system table, a declared temporary table, or a summary table.

Syntax diagram

Read syntax diagramSkip visual syntax diagramIMPORTFROMfilename COMMITCOUNTnCOMMITnRESTARTCOUNTn|SKIPCOUNTnRESTARTn|SKIPnROWCOUNTnROWn INSERTINTOtable_name

Command parameters

filename
Specifies the file that contains the import data. You can specify a path as part of the filename variable. The path can be absolute or relative to the current directory. If the path is omitted, the current directory is searched.
COMMITCOUNT | COMMIT n
When specified, IMPORT commits data after every n records are read and imported.
RESTARTCOUNT | RESTART n
When specified, IMPORT starts at record n+1. The first n records are skipped. This option is functionally equivalent to SKIPCOUNT. RESTARTCOUNT and SKIPCOUNT are mutually exclusive.
SKIPCOUNT | SKIP n
When specified, IMPORT starts at record n+1. The first n records are skipped. This option is functionally equivalent to RESTARTCOUNT. RESTARTCOUNT and SKIPCOUNT are mutually exclusive.
ROWCOUNT | ROW n
When specified, n physical records from the beginning of filename are imported. When ROWCOUNT is specified with RESTARTCOUNT or SKIPCOUNT, IMPORT reads n rows from filename starting from the record that is defined by RESTARTCOUNT or SKIPCOUNT.
table_name
Specifies the target database table for the IMPORT operation. This table cannot be a system table, a declared temporary table or a summary table. If not fully qualified with a schema, the default schema is the current ID.

Examples

The following IMPORT command reads the first 100 rows of the c:\data.txt file and inserts the data into the db2admin.emptab table:
import from c:\data.txt rowcount 100 insert into db2admin.emptab;                           
The following IMPORT command starts reading data at row 11 of the data.txt file and inserts the data into the emptab table:
import from data.txt skip 10 insert into emptab;
The following IMPORT command starts reading data at row 11 of the data.txt file, one directory up in the directory tree relative to the current directory. The command inserts the data into the emptab table.
import from ./data.txt restart 10 insert into emptab;