Freigeben über


ADD TABLE Command

Adds a free table to the current database.

ADD TABLE TableName | ?   [NAME LongTableName]

Parameters

  • TableName
    Specifies the name of the table added to the database.
  • ?
    Displays the Open dialog box from which you can choose a table to add to the database.
  • NAME LongTableName
    Specifies a long name for the table. Long names can contain up to 128 characters and can be used in place of short file names that have a .DBF extension.

Remarks

After the table is added to the database, you can perform the same operations on it as you can on any other table.

Once the table is added to the database, it is no longer free. However, any table in the database can be made free by issuing REMOVE TABLE.

The table you are adding:

  • Must be a valid .DBF file.
  • Cannot have the same name as an existing table in the open database, unless you assign the table a unique long name.
  • Cannot exist in another database. Use REMOVE TABLE to remove the table from another database.

The database to which you are adding a table cannot be involved in a transaction.

Example

The following example creates two databases named mydbc1 and mydbc2, and a table named table1. The table is added to mydbc1 when it is created. The table is then closed and removed from mydbc1. ADD TABLE is then used to add the table to mydbc2. RENAME TABLE is used to change the name of the table from table1 to table2.

CREATE DATABASE mydbc1
CREATE DATABASE mydbc2
SET DATABASE TO mydbc1
CREATE TABLE table1 (cField1 C(10), n N(10))  && Adds table to mydbc1
CLOSE TABLES     && A table must be closed to remove it from a database
REMOVE TABLE table1
SET DATABASE TO mydbc2
ADD TABLE table1
RENAME TABLE table1 TO table2

See Also

CLOSE Commands | CREATE DATABASE | DISPLAY TABLES | FREE TABLE | OPEN DATABASE | REMOVE TABLE