Tuesday, June 14, 2011

Creating Tables

You can create a table in a database, or just create a free table not associated with a database. If you put
the table in a database, you can create long table and field names for database tables. You can also take
advantage of data dictionary capabilities for database tables, long field names, default field values, fieldand
record-level rules, as well as triggers.

Designing Database vs. Free Tables
A Visual FoxPro table, or .dbf file, can exist in one of two states: either as a database table (a table
associated with a database) or as a free table that is not associated with any database. Tables associated
with a database have several benefits over free tables. When a table is a part of a database you can create:

  • Long names for the table and for each field in the table.
  • Captions and comments for each table field.
  • Default values, input masks, and format for table fields.
  • Default control class for table fields.
  • Field-level and record-level rules.
  • Primary key indexes and table relationships to support referential integrity rules.
  • One trigger for each INSERT, UPDATE, or DELETE event.

Some features apply only to database tables. For information about associating tables with a database,
see Creating Databases.
Database tables have properties that free tables don’t.


You can design and create a table interactively with the Table Designer, accessible through the Project
Manager or the File menu, or you can create a table programmatically with the language. This section
primarily describes building a table programmatically. For information on using the Table Designer to
build tables interactively, see Creating Tables and Indexes, in the User’s Guide.
You use the following commands to create and edit a table programmatically:



Commands for Creating and Editing Tables

  • ALTER TABLE 
  • CLOSE TABLES
  • CREATE TABLE 
  • DELETE FILE
  • REMOVE TABLE 
  • RENAME TABLE
  • DROP TABLE

No comments:

Post a Comment