CREATE FROM Command
Creates a table from a table created by the COPY STRUCTURE EXTENDED command.
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. - FROM [FileName2]
Specifies the table, created either manually or with COPY STRUCTURE EXTENDED, from which the new table is created.
Remarks
This variation of CREATE assumes that the table specified in FileName2 has been created either manually with COPY STRUCTURE EXTENDED. A new table FileName1 is created with the structure described in FileName2. The newly created table becomes the active table.
If you do not include either FileName1 or FileName2, or both, a dialog box appears. In this dialog box, you can specify the file to create or the FROM file, or both.
Note All records in FileName2, including those marked for deletion, are used to create FileName1.
CREATE FROM turns on autoincrementing for fields when the FIELD_STEP field in the table created by COPY STRUCTURE EXTENDED contains a valid value. The autoincrementing value and step values are retained from the original table.
Example
The following example displays the structure of the "Orders" table, copies the structure extended file 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