> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# /export/records/totable

```
URL: http://<db.host>:<db.port>/export/records/totable
```

Exports records from source table to the specified target table in an external
database.

## Input Parameter Description

<ParamField body="table_name" type="string">
  Name of the table from which the data will be exported to remote database, in \[schema\_name.]table\_name format, using standard [name resolution rules](../../concepts/tables/#table-name-resolution).
</ParamField>

<ParamField body="remote_query" type="string">
  Parameterized insert query to export gpudb table data into remote database.

  The default value is ''.
</ParamField>

<ParamField body="options" type="map of string to strings">
  Optional parameters.

  The default value is an empty map ( \{} ).

  <Expandable title="options">
    <ParamField body="batch_size">
      Batch size, which determines how many rows to export per round trip.

      The default value is `200000`.
    </ParamField>

    <ParamField body="datasink_name">
      Name of an existing external data sink to which table name specified in input parameter *table\_name* will be exported.
    </ParamField>

    <ParamField body="jdbc_session_init_statement">
      Executes the statement per each JDBC session before doing actual load.

      The default value is ''.
    </ParamField>

    <ParamField body="jdbc_connection_init_statement">
      Executes the statement once before doing actual load.

      The default value is ''.
    </ParamField>

    <ParamField body="remote_table">
      Name of the target table to which source table is exported. When this option is specified remote\_query cannot be specified.

      The default value is ''.
    </ParamField>

    <ParamField body="use_st_geomfrom_casts">
      Wraps parameterized variables with st\_geomfromtext or st\_geomfromwkb based on source column type.

      The default value is `false`.

      The supported values are:

      * true
      * false
    </ParamField>

    <ParamField body="use_indexed_parameters">
      Uses \$n style syntax when generating insert query for remote\_table option.

      The default value is `false`.

      The supported values are:

      * true
      * false
    </ParamField>
  </Expandable>
</ParamField>

## Output Parameter Description

The Kinetica server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query.  Here is a description of the various fields of the wrapper:

<ResponseField name="status" type="String">
  'OK' or 'ERROR'
</ResponseField>

<ResponseField name="message" type="String">
  Empty if success or an error message
</ResponseField>

<ResponseField name="data_type" type="String">
  'export\_records\_to\_table\_response' or 'none' in case of an error
</ResponseField>

<ResponseField name="data" type="String">
  Empty string
</ResponseField>

<ResponseField name="data_str" type="JSON or String">
  This embedded JSON represents the result of the /export/records/totable endpoint:

  <Expandable title="data_str">
    <ResponseField name="table_name" type="string">
      Value of input parameter *table\_name*.
    </ResponseField>

    <ResponseField name="count_inserted" type="long">
      Number of records inserted into the target table.
    </ResponseField>

    <ResponseField name="count_skipped" type="long">
      Number of records skipped.
    </ResponseField>

    <ResponseField name="count_updated" type="long">
      \[Not yet implemented]  Number of records updated within the target table.
    </ResponseField>

    <ResponseField name="info" type="map of string to strings">
      Additional information.
    </ResponseField>
  </Expandable>

  Empty string in case of an error.
</ResponseField>
