Microsoft KB Archive/95710

{|
 * width="100%"|

-

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 1.02, 2.0

-

SUMMARY
If some basic rules are followed, FoxPro can convert fields to different types within a database without data loss.

MORE INFORMATION
The usual method for converting a field type in a database involves using the MODIFY STRUCTURE command. Below is a table that summarizes the types of field data that are possible and also indicates if data may be lost in the translation. &quot;Yes&quot; indicates that the data will be preserved, &quot;No&quot; indicates that data will be lost, and &quot;Possibly&quot; depends on the data involved.

Data Type Char   Numeric   Float     Date     Logical     Memo ---

Char             Possibly  Possibly  Possibly Possibly    No Numeric    Yes              Yes       No        No         No Float      Yes    Yes                 No        No         No Date       Yes    No        No                  No         No Logical    Yes    No        No        No                   No Memo       No     No        No        No        No Note: Depending on the string to be converted, a character field can be converted into any other field, except a memo field.

When a character field is converted to a float or numeric, only numeric characters are converted. In a numeric field, the characters will be rounded unless a decimal point is part of the numeric field definition. Moreover, when a character field is converted to a numeric field, the sizes of the fields must match or data will be lost.

Character fields can be converted to date fields if the data in the character field is formatted as a valid date string. The following date formats are supported by default: mm/dd/yy

mm-dd-yy Character fields can also be converted to logical fields if the first letter of the field is one of the following and is in uppercase: "T F Y N" A numeric or float field can be converted to a character field as long as the field is large enough to hold the converted data. If the field is not large enough, data loss will occur.

Date fields can be converted only to character fields without the risk of data loss. If you attempt to convert the date field to another format, the data will be lost and a blank field will be created.

A logical field can be converted only to a character field without the risk of data loss. The logical data that is stored is always converted to a T or F character. Additional query words: FoxDos conversion data types

Keywords         : Version          : Platform         : Issue type       :
 * }