Compartir a través de


How to: Create Database Tables

You can use a wizard to help you create a database table, or you can create an empty database table. A wizard helps you create a table using your answers to a series of questions.

Note

When you create a database table with an open database, the database table is associated automatically with the open database. If multiple databases are open, the table is associated with the open database set as the current database. The table's association with the database is stored as a back link in the table's header record. For more information, see Databases in Visual FoxPro and How to: Open Databases.

When you create a table, a table (.dbf) file is created to store the table file. For information about naming tables, see How to: Name Tables.

To create a database table using a wizard

  1. Open the database you want to create a table in.

  2. On the Database menu, click Create Table.

  3. In the New Table dialog box, click Table Wizard.

  4. Follow the instructions on the wizard screens.

For more information, see Table Wizard.

You can also begin the wizard from a project in the Project Manager by expanding the Data node, the Databases node, and then node for your database. Click the Tables node, and then New. In the New Table dialog box, click Table Wizard. For more information, see Project Manager Window.

To create an empty database table

  1. Open the database you want to create a table in.

  2. On the Database menu, click Create Table.

  3. In the New Table dialog box, click New Table.

  4. In the Create dialog box, select the location you want to save the database table, and type a name for the table.

  5. Click Save.

    The Table Designer opens so you can specify table fields, items, and other attributes.

For more information, see Table Designer (Visual FoxPro).

To create a database table in a project

  1. Open the project with the database in the Project Manager.

  2. In the Project Manager, expand the Data node, the Databases node, and then node for your database.

  3. Click the Tables node, New, and then New Table.

  4. In the Create dialog box, select the location you want to save the database table, and type a name for the table.

  5. Click Save.

    The Table Designer opens so you can specify table fields, items, and other attributes.

For more information, see Project Manager Window and Table Designer (Visual FoxPro).

To create a database table programmatically

  1. Open the database you want to create a table for.

  2. Perform one of the following:

    • To create a table by opening the Table Designer, use the CREATE command.

      -OR-

    • To create a table without opening the Table Designer, use the SQL CREATE TABLE command.

For more information, see CREATE Command and CREATE TABLE - SQL Command.

See Also

Tasks

How to: Edit Table Structure

Other Resources

Working with Tables (Visual FoxPro)

Creating Tables