MODIFY STRUCTURE
Topic group Related topics Example
Allows you to modify the structure of the current table.
Syntax
MODIFY STRUCTURE
Description
Use MODIFY STRUCTURE to change the structure of the current table by adding or deleting fields, or changing a field name, width, or data type. Issuing the MODIFY STRUCTURE command opens the Table designer, an interactive environment in which you can create or modify the structure of a table. dBASE Plus will reopen a table in EXCLUSIVE mode if it wasn't already exclusive when you issued the MODIFY STRUCTURE command.
Before allowing changes to the structure of a dBASE table, dBASE Plus makes a backup of the original table assigning the file a .DBK extension. dBASE Plus then creates a new table file with the .DBF extension and copies the modified table structure to that file. When you've finished modifying a table structure, dBASE Plus copies the content of the backup file into the new structure. If data is accidentally truncated or lost, you can recover the original data from the .DBK file. Before modifying the structure of a table, make sure that you have sufficient disk space to create the backup file plus any temporary storage required to copy records between the two tables (approximately twice the size of the original table).
If a table contains a memo field, MODIFY STRUCTURE also creates a backup memo file to store the original memo field data. This file has the same name as the table, but is given a .TBK extension.
You shouldn't change a field name and its width or type at the same time. If you do, dBASE Plus won't be able to append data from the old field, and your new field will be blank. Change the name of a field, save the file, and then use MODIFY STRUCTURE again to change the field width or data type.
Also, don't insert or delete fields from a table and change field names at the same time. If you change field names, MODIFY STRUCTURE appends data from the old file by using the field position in the file. If you insert or delete fields as well as change field names, you change field positions and could lose data. You can, however, change field widths or data types at the same time as you insert or delete fields. In those cases, since MODIFY STRUCTURE appends data by field name, the data will be appended correctly.
dBASE Plus successfully converts data between a number of field types. If you change field types, however, keep a backup copy of your original file, and check your new files to make sure the data has been converted correctly.
If you convert numeric fields to character fields, dBASE Plus converts numbers from the numeric fields to right-aligned character strings. If you convert a character field to a numeric field, dBASE Plus converts numeric characters in each record to digits until it encounters a non-numeric character. If the first character in a character field is a letter, the converted numeric field will contain zero.
You can convert logical fields to character fields, and vice versa. You can also convert character strings that are formatted as a date (for example, mm/dd/yy or mm-dd-yy) to a date field, or convert date fields to character fields. You can't convert logical fields to numeric fields.
In general, dBASE Plus attempts to make a conversion you request, but the conversion must be a sensible one or data may be lost. Numeric data can easily be handled as characters, but logical data, for example, cannot become numeric. To convert incompatible data types (such as logical to numeric), first add a new field to the file, use REPLACE to convert the data, then delete the old field.
If you modify the field name, length, or type of any fields that have an associated tag in the production (.MDX) file, the tag is rebuilt. If any indexes are open when you modify a table structure, dBASE Plus automatically closes those indexes when saving the modified table. You should re-index the table after you modify its structure.