Creates and opens a database.
CREATE DATABASE [DatabaseName | ?]
- [ DatabaseName| ?]
Specifies the name of the database to create or opens the Create dialog box so you can specify a name for the database and the location where you want to save the database. Omitting arguments for these parameters also opens the Create dialog box.
Database files are saved with a .dbc file name extension.
Note: If the SET SAFETY command is set to ON, and the database name that you specify has the same path and name as an existing database, Visual FoxPro prompts you to specify a different path or name for the database.
A database (.dbc) file is created with an associated database memo (.dct) file and database index (.dcx) file.
The database opens exclusively, regardless of the setting of SET EXCLUSIVE. Because CREATE DATABASE opens the database after it has been created, you do not need to call a subsequent OPEN DATABASE command.
Using CREATE DATABASE does not add the database automatically to a project even when the Project Manager is open. You must explicitly add a database to an application project to include it. For more information, see
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