Background documentationIMPORT TABLE Command Locate this document in the navigation structure

 

You can use the Loader command IMPORT TABLE to control the import of application data and/or the corresponding database catalog information for a user’s objects.

Prerequisites

The objects imported with an IMPORT TABLE command belong to the user logged on to the database at the time of import. You have either exported the required data with the corresponding EXPORT command or the data is available in the specified data format.

Structure

Syntax Syntax

  1. <import_table_command> ::=
      IMPORT TABLE <table_name>
        [<if_condition>]
        [<duplicates_clause>]
        <catalog_data_instream_table_spec>
        [<package_spec>]
    
    <duplicates_clause> ::=
      REJECT DUPLICATES
    | IGNORE DUPLICATES
    | UPDATE DUPLICATES
    
    <catalog_data_instream_table_spec> ::=
      <catalog_instream_spec>
    | <data_instream_table_spec>
    | <catalog_instream_spec> <data_instream_table_spec>
    <catalog_instream_spec> ::=
      CATALOG <instream_ddl_spec>
    <data_instream_table_spec> ::=
      <data_instream_part_spec>
    | <data_instream_columns_spec>
    <data_instream_part_spec> ::=
      DATA <instream_tableformat_spec>
    <data_instream_columns_spec> ::=
      DATA <instream_columnformat_spec>
        [<import_column_spec> ... <import_lobcolumn_spec> ...] [<usage_spec>]
    
    <package_spec> ::=
      PACKAGE <oustream_csv_spec>
End of the code.
<catalog_instream_spec>, <data_instream_table_spec>

Depending on whether database catalog and/or application data is imported, the following data streams are generated during the import:

  • Data stream with database catalog information CATALOG <instream_ddl_spec>

  • Data stream with application data data_instream_table_spec

System table SYSLOADER.TRANSFORMATIONMODEL and additional system tables are filled.

See: Data Stream

Syntax Syntax

  1. IMPORT TABLE <table_name>
      [<if_condition>]
      [<duplicates_clause>]
      <catalog_instream_spec> <data_instream_table_spec>
      [<package_spec>]
End of the code.

This IMPORT TABLE command imports the data from the specified table (database catalog and application data).

Syntax Syntax

  1. IMPORT TABLE <table_name>
      <catalog_instream_spec>
      [<package_spec>]
End of the code.

This IMPORT TABLE command imports the database catalog information of a table belonging to the application.

Syntax Syntax

  1. IMPORT TABLE <table_name>
      [<if_condition>]
      [<duplicates_clause>]
      <data_instream_table_spec>
      [<package_spec>]
End of the code.

This IMPORT TABLE command imports the application data from the specified table.

More information on the syntax element data_instream_table_spec:

<data_instream_part_spec> ::= DATA <instream_tableformat_spec>

To import the data in the PAGES or RECORDS formats, use syntax variant DATA <instream_tableformat_spec>. We recommend this option if you do not need the data in a readable format and you want to import the data from one SAP MaxDB database to another. All the data, including the LOB data, is in the specified data stream.

<data_instream_columns_spec> ::= DATA <instream_columnformat_spec> [<import_column_spec>... <import_column_spec>...] [<usage_spec>]

To import the data in CSV or FWV [BINARY] formats, use syntax variant DATA <instream_columnformat_spec>. We recommend this option if you need the data in a readable form, for example for tools from other providers. It is possible to import the data from one SAP MaxDB database to another, but it takes much longer than if you use RECORDS or PAGES format. If you use CSV and FWV [BINARY] formats, extra data streams are created for the LOB data during export. If you want to import LOB values, you need to specify a separate data stream for these column values. You can do this with the import_lobcolumn_spec syntax element (Importing LOB Values).

<usage_spec>

You can use the syntax rule usage_spec to specify whether data that is available in the CSV or FWV [BINARY] format is to be imported with a mass INSERT (RECORDS USAGE) or with pages (PAGE WITH ...). When importing sorted application data to a table, you can control the performance with usage_spec. You can import by pages (PAGE WITH ...) if the table definition of the target table satisfies certain conditions. If you select PAGE WITH ..., the data is entered directly in the pages of the database and no log entries are written. This improves the performance compared to the RECORDS USAGE option. However, the table is write-protected until you back up the new application data.

See: Performance Improvement in the IMPORT TABLE Command

<if_condition>

You can select individual data records from a DATA data stream in the formats CSV, FWV or RECORDS and then import only these records to the specified table.

See: Selecting Data records

<duplicates_clause>

You use the DUPLICATES clause to specify how to proceed when importing data from a data stream if a row with the same key as the new row already exists in the table. This clause is not evaluated if the data is imported into the database in PAGES format.

REJECT DUPLICATES

The new line is rejected with an error message (default value).

IGNORE DUPLICATES

The new line is not inserted.

UPDATE DUPLICATES

The new line overwrites the existing line.

<package_spec>

You can export system table SYSLOADER.TRANSFORMATIONMODEL.

  • If you specify a data stream using PACKAGE <outstream_csv_spec>, all entries in the SYSLOADER.TRANSFORMATIONMODEL table are exported to this data stream. We recommend you use this option to create a log of the export or import process.

  • If you do not specify a data stream using PACKAGE <outstream_csv_spec>, the system table SYSLOADER.TRANSFORMATIONMODEL is not exported.

See: Additional Log Functions (package_spec)

Result

The application data and/or database catalog are imported to the data_instream_table_spec and catalog_instream_spec data streams. If necessary, all entries in the TRANSFORMATIONMODEL table are exported to the package_spec data stream.

Errors: The import cannot be completed successfully. The Loader logs the cause of the error in the log file. The values PACKAGEGUID and CLIENTNODE are also written to the log file. The PACKAGEGUID is required if you want to restart the export.

Example

Loader Tutorial, IMPORT TABLE