Icon Renaming Tables

Introduction
Renaming tables is accomplished through the RenameTable method of the TDBISAMTable component. The properties used by the RenameTable method include the DatabaseName, TableName, and Exists properties.

Renaming a Table
To rename a table, you must specify the DatabaseName and TableName properties of the TDBISAMTable component and then call the RenameTable method. The table component must be closed and the Active property must be False. It is usually good practice to also examine the Exists property of the TDBISAMTable component first to make sure that you don't attempt to rename a non-existent table. If you do attempt to rename a non-existent table an EDBISAMEngineError exception will be raised. The error code given when a table rename fails due to the table not existing is 11010 and is defined as DBISAM_OSENOENT in the dbisamcn unit (Delphi) or dbisamcn header file (C++).

The following example shows how to rename the "customer" table to the "oldcustomer" table using the RenameTable method:

{
   MyTable->DatabaseName="d:\\temp";
   MyTable->TableName="customer";
   if (MyTable->Exists)
      {
      MyTable->RenameTable("oldcustomer");
      }
}

Information You should be extremely careful when using this method since renaming a table can break applications and cause them to encounter errors when trying to open up a table that no longer exists under the same name.

In addition to using the TDBISAMTable RenameTable method for renaming tables, DBISAM also allows the use of the RENAME TABLE SQL statement.
Image