Compartilhar via


CREATE DATABASE Command

Creates a database and opens it.

CREATE DATABASE [DatabaseName | ?]

Parameters

  • DatabaseName
    Specifies the name of the database to create.

    If SAFETY is set to ON and the database name you specify has the same path and name as an existing database, Visual FoxPro displays a warning dialog box that prompts you to specify a new path or name for the database.

  • ?
    Displays the Create dialog box from which you can specify the name of the database to create.

Remarks

A database file has a .dbc extension. The associated database memo files have a .dct extension, and the associated index files have a .dcx extension.

The database is opened exclusively, regardless of the setting of SET EXCLUSIVE. Because CREATE DATABASE opens the database after it has been created, you do not have to issue a subsequent OPEN DATABASE command.

If CREATE DATABASE is issued without any of its optional arguments, the Create dialog box is displayed, allowing you to specify a name for the database.

Example

This example creates a database named people. A table named friends is created and is automatically added to the database. DISPLAY TABLES is used to display the tables in the database, and DISPLAY DATABASES is used to display information about the tables in the database.

CREATE DATABASE people
CREATE TABLE friends (FirstName C(20), LastName C(20))
CLEAR
DISPLAY TABLES  && Displays tables in the database
DISPLAY DATABASES  && Displays table information

See Also

ADD TABLE | CLOSE DATABASES | DBC( ) | DBGETPROP( ) | DBSETPROP( ) | DELETE DATABASE | DISPLAY TABLES | FREE TABLE | INDBC( ) | MODIFY DATABASE | OPEN DATABASE | PACK DATABASE | REMOVE TABLE | SET DATABASE | VALIDATE DATABASE | ADBOBJECTS( ) | ADATABASES( )