# Importing data using the built-in procedures

You can use the Derby import procedures to import all of the data from a table or query, or to import LOB data separately from the other data.

Use the following table to choose the correct procedure for the type of import that you want to perform. For examples of these procedures, see Examples of bulk import and export.

Table 1. Using the built-in import procedures
Type of Import | Procedure to Use
--- | ---
To import all the data to a table, where the import file contains the LOB data |
    SYSCS_UTIL.SYSCS_IMPORT_TABLE
     (IN SCHEMANAME VARCHAR(128),
      IN TABLENAME VARCHAR(128),
      IN FILENAME VARCHAR(32672),
      IN COLUMNDELIMITER CHAR(1),
      IN CHARACTERDELIMITER  CHAR(1),
      IN CODESET VARCHAR(128),
      IN REPLACE SMALLINT)
To import the data to a table, where the LOB data is stored in a separate file and the main import file contains all of the other data with a reference to the LOB data |
    SYSCS_UTIL.SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE
     (IN SCHEMANAME VARCHAR(128),
      IN TABLENAME VARCHAR(128),
      IN FILENAME VARCHAR(32672),
      IN COLUMNDELIMITER CHAR(1),
      IN CHARACTERDELIMITER CHAR(1),
      IN CODESET VARCHAR(128),
      IN REPLACE SMALLINT)
The import utility looks in the main import file for a reference to the location of the LOB data. The format of the reference to the LOB stored in the main import file must be `lobsFileName.Offset.length/`.
To import data from a file to a subset of columns in a table, where the import file contains the LOB data |
    SYSCS_UTIL.SYSCS_IMPORT_DATA
     (IN SCHEMANAME VARCHAR(128),
      IN TABLENAME VARCHAR(128),
      IN INSERTCOLUMNS VARCHAR(32672),
      IN COLUMNINDEXES VARCHAR(32672),
      IN FILENAME VARCHAR(32672),
      IN COLUMNDELIMITER CHAR(1),
      IN CHARACTERDELIMITER CHAR(1),
      IN CODESET VARCHAR(128),
      IN REPLACE SMALLINT)
You must specify the `INSERTCOLUMNS` parameter on the table into which data will be imported. You must specify the `COLUMNINDEXES` parameter to import data fields from a file to a column in a table.
To import data to a subset of columns in a table, where the LOB data is stored in a separate file and the main import file contains all of the other data with a reference to the LOB data |
    SYSCS_UTIL.SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE
     (IN SCHEMANAME VARCHAR(128),
      IN TABLENAME VARCHAR(128),
      IN INSERTCOLUMNS VARCHAR(32672),
      IN COLUMNINDEXES VARCHAR(32672),
      IN FILENAME VARCHAR(32672),
      IN COLUMNDELIMITER CHAR(1),
      IN CHARACTERDELIMITER CHAR(1),
      IN CODESET VARCHAR(128),
      IN REPLACE SMALLINT)
The import utility looks in the main import file for a reference to the location of the LOB data. The format of the reference to the LOB stored in the main import file must be `lobsFileName.Offset.length/`.

- Parameters for the import procedures
  The Derby import procedures use specific parameters.
- Import into tables that contain identity columns
  You can use the either the SYSCS_UTIL.SYSCS_IMPORT_DATA procedure or the SYSCS_UTIL.SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE procedure to import data into a table that contains an identity column. The approach that you take depends on whether the identity column is GENERATED ALWAYS or GENERATED BY DEFAULT.

Parent topic: Importing and exporting data
Related concepts
Methods for running the import and export procedures
Bulk import and export of large objects
File format for input and output
Running import and export procedures from JDBC
How the import and export procedures process NULL values
Bulk import and export requirements and considerations
Related tasks
Exporting data using the built-in procedures
Related reference
CODESET values for import and export procedures
Examples of bulk import and export
Parameters for the import procedures