How to: Add Fields to Tables

When opening the table in the Table Designer, the Fields tab displays a row for the first field and adds a field following the field as you define it. You can add additional fields to the table in the order that you want.

To add a field to a table

  1. Open the table in the Table Designer.

  2. On the Fields tab, insert the cursor in the field that follows the one you want to add.

  3. Click Insert.

    A new field appears preceding the selected field with a default field name, type, and width.

  4. Change the attributes for the field to the ones you want.

  5. When you are finished, click OK.

    Visual FoxPro prompts you to confirm changes to table structure.

  6. To confirm the table structure changes, click Yes.

To add a field to a table programmatically

  • Use the SQL ALTER TABLE command and include the ADD COLUMN clause.

For more information, see ALTER TABLE - SQL Command.

For example, the following code adds a field named Fax with Character type and a field width of 10 characters to a customer table:

 CopyCode imageCopy Code

See Also

© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic