Deleting a Database Table

If a table is associated with a database, you can delete the table as a by-product of removing the table from its database. Deleting a table is different from removing a table from a database, however. If you just want to remove a table from a database but do not want to physically delete the table from disk, see Removing a Table from a Database in Creating Databases.

To delete a database table from disk

  • In the Project Manager, select the table name, choose Remove, and then choose Delete.

    -or-

  • From the Database Designer, select the table, choose Remove from the Database menu, and then choose Delete.

    -or-

  • To delete the table plus all primary indexes, default values, and validation rules associated with the table, use the DROP TABLE command.

    -or-

  • To delete just the table file (.dbf), use the ERASE command.

    Caution   If you use the ERASE command on tables associated with a database, the command does not update the backlink to the database and can cause table access errors.

The following code opens the database testdata and deletes the table orditems and its indexes, default values, and validation rules:

OPEN DATABASE testdata
DROP TABLE orditems

If you delete a table using the DELETE clause of the REMOVE TABLE command, you also remove the associated .fpt memo file and .cdx structural index file.

See Also

Table Creation | Renaming a Table | Deleting a Free Table | Working with Tables | Duplicating a Table | Naming a Table | Viewing Data in Tables | Customizing a Browse Window | Customizing Tables