Background documentationEXPORT COLUMNS Command Locate this document in the navigation structure

 

You can use the Loader command EXPORT COLUMNS to export individual column values from a table.

Prerequisites

You must have access authorization for the tables from which you want to export data.

Structure

Syntax Syntax

  1. <export_columns_command> ::=
      EXPORT COLUMNS <select_expression>
        [MAP COLUMNS <export_column_spec> ...]
        <data_outstream_column_spec>
    
    <select_expression> ::=
      <!  SELECT statement without specifying the keyword SELECT  !>
    
    <data_outstream_column_spec> ::=
      DATA <outstream_columnformat_spec> [<export_lobcolumn_spec> ...]
    
    <package_spec> ::=
      PACKAGE <oustream_csv_spec>
End of the code.

You can use the EXPORT COLUMNS command to specify the table columns from which you want to export the application data (DATA). You can link several tables and specify a sort order for the exported data.

<select_expression>

You use the syntax rule select_expression to specify which columns in a table are to be exported. The database query is formulated in the same way as a SELECT statement, except that the SELECT keyword is not used. All SELECT statement options are permitted:

  • Select the result columns and determine their order in the result table

  • Join multiple tables

  • Use qualifications to select result rows

  • Specify sort order

  • Specify locks and the isolation level

<export_column_spec>

If you specify the syntax element export_column_spec, you describe the columns in a source table that are to be exported (output columns) and how the data records are represented in the data stream.

  • The columns can be in any order in the column description.

  • The column list can only contain columns of the SELECT statement or a subset of these columns.

  • Values are output only for the columns in the column list. If the column list contains more columns than the SELECT statement, Loader generates an error and terminates the command.

  • If you want to assign the columns of the source table to fields of the data stream you have to use the keyword MAP COLUMNS.

  • If you have defined CSV format for the data stream, the values of the columns to be exported are output in the order defined in the SELECT statement and separated with separators.

  • If you have defined format FWV for the data stream, the values of the columns to be extracted are formatted and output in the order defined in the SELECT statement. The length of the output values depends on the sizes defined for the individual columns of the source table.

  • If the SELECT statement does not contain any column names (EXPORT COLUMNS * FROM ...), the format of the columns is the same as that of the data stream. They are output in the order specified by the database catalog.

Result

The application data is exported to the outstream_columnformat_spec data stream and, if appropriate stating the LOB specification export_lobcolumn_spec. The application data can be reconstructed with the corresponding IMPORT command.

Errors: The export cannot be completed successfully. Loader logs the cause of the error in the log file.

Example

Loader Tutorial, EXPORT COLUMNS