Copy the content of a table to another. You can indicate form condition to perform a selection of the registers to copy.

# 1 table.copy

<table.copy    src='[database_src:]table_src'    dst='[database_dst:]table_dst'    where='where'    order='order'    maxrows='maxrows'/>

#### Exceptions

Required attribute [...]

A required attribute has not been informed.

Example

Copies a maximum of 3 registers from the table "cdiary" in the table "cdiary:copy" with the indicated condition and order.

Copy
<xsql-script name='sample_table_copy'>
<body>
<set name='nrows'>
<table.copy src="cdiarios" dst="cdiarios_copy" where="nomdia LIKE '%empresa ACME%'" order="codigo desc" maxrows="3" />
</set>
<println><nrows/> have been copied.</println>
</body>
</xsql-script>
Connect to another database

This script shows how to connect to a different source database to get data. The script is executed on the destiny database.

Copy
<xsql-script name='sample_table_copy'>
<body>
<set name='nrows'>
<table.copy src="dbsource:cdiarios" dst="cdiarios_copy" where="nomdia LIKE '%empresa ACME%'" order="codigo desc" maxrows="3" />
</set>
<println><nrows/> have been copied.</println>
</body>
</xsql-script>

#### Información

This function copies content of a table to another of the same database. Also, both tables should exist in the database.

To copy content between differents databases should be used the function connection.schema.copy