Q: How do I move a table to another database?

A: You can use the LOAD and UNLOAD commands within dmSQL.

The UNLOAD command will download the data from the table and the table schema to an external file.

This external file is a script file, including dmSQL commands for creating the table schema, index and inserting new data. It will be used when uploading the table using the LOAD command.

There are two kinds of UNLOAD commands that can be used on a table.

  1. UNLOAD TABLE command. This command will not only download the data, but also record in the file the commands for creating the table.

  2. The other is the UNLOAD DATA command. This command will download the data only.

The following examples illustrate how to remove table tb1 from database db1 to database db2 using dmSQL

Example one :

		  dmSQL> connect to db1 SYSADM;
		  dmSQL> unload table from tb1 to 'j:\database\tb1';
		  dmSQL> disconnect db1 ; dmSQL> connect to db2 SYSADM;
		  dmSQL> load table from 'j:\database\tb1';

To unload the whole database, enter the commands below :

Example two :

		  dmSQL> connect to database-name SYSADM;
		  dmSQL> unload db to new-database-name