RAD Studio for Microsoft .NET
ContentsIndex
PreviousUpNext
Migrating Data Between Databases

The DataExplorer makes it easy to migrate data from one database to another, and even between providers. The DataExplorer lets you quickly copy a table from one database and paste it into another database. Both the structure and the data for the table or tables is migrated.  

Data migration is supported by the BdpCopyTable class, which is available as a designtime component from the Tool Palette. You can use this component to programmatically migrate data.

Note: The BdpCopyTable class does not copy foreign keys or dependent objects.

To migrate multiple tables

  1. Choose ViewData Explorer.
  2. Right-click a provider type, such as Interbase, and choose Migrate Data. The Data Explorer page for data migration opens in the Code Editor. This data migration page lets you select one or more tables from a source provider connection and a destination connection to which the tables will be migrated.
  3. Choose a connection from the Source Connection drop-down list box. The tables associated with this connection appear in the list box beneath the connection.
  4. Choose a connection from the Destination Connection drop-down list box. The tables associated with this connection appear in the list box beneath the connection.
  5. Select one or more tables to migrate from the list of tables associated with the source connection. To select consecutive tables, click the first table, press and hold down the SHIFT key, and then click the last table. To select nonconsecutive tables, press and hold down CTRL, and then click each table.
  6. Click the Include (>) button to include these tables for migration to the destination connection. The selected tables appear in the list of tables for the destination connection. If one of the selected tables has the same name as a table in the destination connection, it cannot be migrated.
  7. Click Migrate to copy the tables to the destination connection. The Data Migration page shows the progress as SQL types are mapped, tables are created, data is retrieved from the source connection, and data is populated in the new table in the destination connection. The result of each operation is reported for each table.
  8. Right-click the Tables node in the destination provider and choose Refresh. Nodes for any new tables appear.
  9. Double-click a new table node to confirm its structure and contents. The table opens in a page on the design surface.

To migrate a single table

  1. Choose ViewData Explorer.
  2. Expand the Tables node in the source provider, and select the database table containing the data and structure you want to migrate. You must have a valid connection to expand the provider nodes.
  3. Right-click the table you want to migrate and choose Copy Table.
  4. Expand the Tables node of the provider into which you want to migrate the data.
  5. Right-click any table and choose Paste Table. The New Table Name dialog box appears.
  6. Enter a name for the new table and click OK.
  7. Right-click the Tables node in the destination provider and choose Refresh. A node for the new table appears.
  8. Double-click the new table node to confirm its structure and contents. The table opens in a page on the design surface.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!