CREATE FROM Command
Creates a table from a COPY STRUCTURE EXTENDED file.
CREATE [FileName1 [DATABASE DatabaseName [NAME LongTableName]]]
FROM [FileName2]
Parameters
- FileName1
Specifies the name of the new table to create. - DATABASE DatabaseName
Specifies a database to which the new table is added. - NAME LongTableName
Specifies a long name for the new table. Long names can contain up to 128 characters and can be used in place of short file names in the database. - FileName2
Specifies the table (created either with COPY STRUCTURE EXTENDED or manually) from which the new table is created.
Remarks
This variation of CREATE assumes that the table specified in FileName2 has been created either with COPY STRUCTURE EXTENDED or manually. A new table FileName1 is created with the structure described in FileName2. The newly created table becomes the active table.
If you don't include either FileName1 or FileName2 or both, a dialog box is displayed. In this dialog, you can specify the file to be created, or the FROM file, or both.
Note that all records in FileName2, including those marked for deletion, are used to created FileName1.
Example
The following example displays the structure of the orders
table, copies the structure extended to the temp
table, browses temp
, creates a table called backup
from temp
, and displays the structure of backup
.
CLOSE DATABASES
CLEAR
SET PATH TO (HOME(2) + 'Data\') && Sets path to database
USE orders
DISPLAY STRUCTURE
WAIT WINDOW 'Structure of the orders table' NOWAIT
COPY STRUCTURE EXTENDED TO temp
USE temp
WAIT WINDOW 'Temp table has 1 row per field in ORDERS' NOWAIT
BROWSE
CREATE backup FROM temp
USE backup
DISPLAY STRUCTURE
WAIT WINDOW 'Backup.dbf has the same structure as ORDERS' NOWAIT
USE
DELETE FILE temp.dbf
DELETE FILE backup.dbf