## EXPORT COLUMNS Command

You can use this Loader command to export individual column values from a table.

### Prerequisites

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

### Syntax

<export_columns_command> ::= EXPORT COLUMNS<select_expression>
[MAP COLUMNS <export_column_spec> ...]
<data_oustream_column_spec>

<export_column_spec> ::= output column

<data_outstream_column_spec> ::= DATA <outstream_columnformat_spec>
[<export_lobcolumn_spec> ...]
<oustream_columnformat_spec> ::= data stream
<export_lobcolumn_spec> ::= exporting LONG values

<select_expression> | SELECT statement without specifying the keyword SELECT Reference Manual, SELECT Statement

### Examples

Loader Tutorial, EXPORT COLUMNS

### Explanation

You can use the EXPORT COLUMNS command to specify the columns of the table from which you wish to export the application data (DATA). When you do this, 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 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_list, 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 from the SELECT statement or a subset of them.

● Values are output only for those columns in the column list. If the column list contains more columns than the SELECT statement, the 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 the CSV format for the data stream, the values of the columns to be exported are output in the order in the SELECT statement, and separated with separators.

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

● If the SELECT statement does not contain any column names (EXPORT COLUMNS * FROM ...), the columns are formatted according to the format of the data stream. They are output in the order specified by the database for processing the command.

### Result

The application data is exported to the outstream_columnformat_spec data stream and, if appropriate stating the long specification export_lobcolumn_spec.

The application data can be reconstructed with the corresponding IMPORT command.

#### Errors

The export cannot be completed successfully. In this case, the Loader logs the cause of the error in the log file.

See also:

Exporting: Commands

IMPORT TABLE Command

IMPORT COLUMN Command

Log File