How to: Name Tables
When you create a table, you need to specify a name for the table (.dbf) file created to store the table. Both database tables and free tables require table file names. Table names must begin with a letter or underscore and can consist of letters, digits, or underscores.
If your table is in a database, you can specify a long table name, which can contain up to 128 characters, in addition to the table file name. You can use long table names instead of conventional file names to identify the table in a database more easily. Visual FoxPro displays long table names when the table appears in the Visual FoxPro interface, for example in the Project Manager, the Database Designer, the Query Designer, and the View Designer as well as in the title bar of a browse window.
Note
If you remove a table from a database, the table retains its file name but not its long name.
To assign a long table name to a database table
Open the database table in the Table Designer.
In the Table Designer, click the Table tab.
In the Name box, type a long name for the table.
To assign a long table name to a database table programmatically
- Include the NAME clause when creating a database table with the SQL CREATE TABLE command.
For more information, see Table Designer (Visual FoxPro) and CREATE TABLE - SQL Command.
Renaming Tables
You can rename the long names for database tables and the file names of database and free tables. You can rename the long names of database tables using the Table Designer because you are changing the long name, not the table file name. You can rename free tables only programmatically because free tables do not have long names.
To change the long name of a database table
Open the database in the Database Designer.
Find and make the table you want to rename active.
On the Database menu, click Modify.
In the Table Designer, click the Table tab.
In the Name box, type a new name for the table.
For more information, see Database Designer (Visual FoxPro) and Table Designer (Visual FoxPro).
To rename a database table programmatically
Set the database containing the table you want to rename as the current database.
Use the RENAME TABLE command.
For more information, see RENAME TABLE Command.
To rename a free table programmatically
Use the RENAME command.
Warning
Do not use the RENAME command on database tables. RENAME does not update the table's back link to the database and might cause errors when accessing the table. Use the RENAME TABLE command instead.
For more information, see RENAME Command.
See Also
Tasks
How to: Create Database Tables