## EXPORT TABLE Command

You can use this Loader command to export all the data from a specified table.

### Prerequisites

The table specified must be available in the database instance.

Only the owner of the table may execute the EXPORT TABLE…PAGES command. In all other cases you must have access authorization for the tables you want to export.

### Syntax

<export_table_command> ::= EXPORT TABLE <table_name>
[<order_clause>]
<catalog_data_outstream_table_spec>
[<package_spec>]

<catalog_data_outstream_table_spec> ::= <catalog_outstream_spec>
| <data_outstream_table_spec>
| <catalog_outstream_spec> <data_outstream_table_spec>

EXPORT TABLE <table_name> [<order_clause>] <catalog_outstream_spec> <data_outstream_table_spec> [<package_spec>] | Exports the data from the specified table (database catalog and application data)
EXPORT TABLE <table_name> <catalog_outstream_spec> [<package_spec>] | Exports the database catalog information from the specified table
EXPORT TABLE <table_name> [<order_clause>] <data_outstream_table_spec> [<package_spec>] | Exports the application data from the specified table

<table_name> | Table name
<order_clause> | ORDER BY <column_name>,...
<column_name> | Column name <column_name> ::= <identifier> See the SQL Reference Manual, Column Name (column_name)
<catalog_outstream_spec> | CATALOG <outstream_ddl_spec>
<data_outstream_table_spec> | <data_outstream_part_spec> | <data_outstream_column_spec>
<data_outstream_part_spec> | DATA <outstream_tableformat_spec>
<data_outstream_column_spec> | DATA <outstream_columnformat_spec> [<export_lobcolumn_spec>...]
<package_spec> | PACKAGE <outstream_csv_spec>
<outstream_ddl_spec> <outstream_tableformat_spec> <outstream_columnformat_spec> <outstream_csv_spec> | Data stream
<export_lobcolumn_spec> | Importing and Exporting LONG Values

### Examples

Loader Tutorial, EXPORT TABLE

### Explanation

You can use the EXPORT TABLE command to export all the data from a specified table. It is not possible to select specific column values with the EXPORT TABLE command; you can only do this with the EXPORT COLUMNS command.

#### <order_clause>

You can use the order_clause to specify the sort sequence for the table rows in the data stream. The columns specified in the order clause determine the sort sequence.

#### <catalog_outstream_spec>, <data_outstream_table_spec>

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

● Data stream for the database catalog definitions CATALOG <outstream_ddl_spec>

● Data stream for application data <data_outstream_table_spec>

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

##### <data_outstream_part_spec> ::= DATA <outstream_tableformat_spec>

To export the data in the PAGES or RECORDS formats, use syntax variant DATA <outstream_tableformat_spec>. We recommend this option if you do not need the data in a readable format and you want to exchange it between MaxDB database instances. All the data is exported in data streams, including the LONG data.

After it has been exported, you can no longer change the data in the data stream.

A table is read-only during the export in data format PAGES.

<data_outstream_column_spec> ::= DATA <outstream_columnformat_spec> [<export_lobcolumn_spec>...]

To export the data in the CSV or FWV [BINARY] formats, use syntax variant DATA <outstream_columnformat_spec>. We recommend this option if you need the data in a readable form; for tools from other providers, for example. It is possible to exchange the data between MaxDB database instances, but it takes much longer than if you use the RECORDS or PAGES formats.

After it has been exported, you can still change the data in the data streams.

If you want to export LONG values, you need to specify a separate data stream for these column values. You can do this with the export_lobcolumn_spec syntax element.

See also:

Data Stream

Importing and Exporting LONG Values

#### <package_spec>

You can export system table SYSLOADER.TRANSFORMATIONMODEL.

● If you specify a data stream by means of PACKAGE <outstream_csv_spec>, all entries of the SYSLOADER.TRANSFORMATIONMODEL table are exported to this data stream. We recommend you use this option to log the export.

● If you do not specify the data stream by means of PACKAGE <outstream_csv_spec>, the system table SYSLOADER.TRANSFORMATIONMODEL is not exported.

See also:

Additional Log Functions (package_spec)

### Result

The application data and/or the database catalog of the table are exported to the data_outstream_table_spec and catalog_outstream_spec data streams.

If necessary, all entries in the table SYSLOADER.TRANSFORMATIONMODEL are exported to the package_spec data stream.

You can use the corresponding IMPORT TABLE command to restore the database catalog and the application data.

### Errors

The export cannot be completed successfully. In this case, 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.

See also:

Exporting: Commands

IMPORT TABLE Command

Log File

System Tables