Data Types

Table 10-2 shows how dBASE data types map to the standard ODBC data types. These dBASE data types can be used in a Create Table statement. Refer to "SQL for Flat-File Drivers" in the DataDirect Connect for ODBC and Connect XE for ODBC Reference for the syntax of the Create Table statement.

Table 10-3 shows how the additional FoxPro 3.0 data types map to the ODBC data types.

NOTE: A few products can create dBASE files with numbers that do not conform to the precision and scale of the Number column. For example, these products can store 100000 in a column declared as NUMBER(5,2). When this occurs, the dBASE driver displays error 1244, Unsupported decimal format. To remedy this situation, multiply the nonconforming column by 1, which converts it to the Float data type. For example:

SELECT BADCOL * 1 FROM BADFILE 

BADCOL * 1 is evaluated as an expression and is returned as a float value.

Table 10-2. dBASE Data Types  
dBASE
ODBC
Binary1
SQL_LONGVARBINARY
Char2
SQL_CHAR
Date
SQL_TYPE_DATE
Float3
SQL_DECIMAL
General4
SQL_LONGVARBINARY
Logical
SQL_BIT
Memo
SQL_LONGVARCHAR
Numeric
SQL_DECIMAL
1 dBASE V only
2 254 characters maximum (1024 for Clipper)
3 dBASE IV and V only
4 FoxPro and dBASE V only

Table 10-3. Additional FoxPro 3.0 Data Types
FoxPro 3.0
ODBC
Character (binary)
SQL_CHAR
Currency
SQL_DOUBLE
Datetime
SQL_TYPE_TIMESTAMP
Double
SQL_DOUBLE
Integer
SQL_INTEGER
Memo (binary)
SQL_LONGVARBINARY

See "Retrieving Data Type Information" for information about retrieving data types.