MDAC 2.5 SDK - ODBC Desktop Database Drivers


 

Text File Data Types

The following table shows how text data types are mapped to ODBC SQL data types. Note that not all ODBC SQL data types are supported by the ODBC Text driver.

Text data type ODBC data type
CHAR SQL_VARCHAR
DATETIME SQL_TIMESTAMP
FLOAT SQL_DOUBLE
INTEGER SQL_INTEGER
LONGCHAR SQL_LONGVARCHAR

Note   SQLGetTypeInfo returns ODBC data types. All conversions in Appendix D of the ODBC Programmer's Reference are supported for the SQL data types listed in the previous table.

The following table shows limitations on Text data types.

Data type Description
CHAR Creating a CHAR column of zero or unspecified length actually returns a 255-bit column.

In delimited files, a CHAR column may or may not have double quotation mark delimiters at the beginning and the end; in fixed-length files, double quotation marks are not used as delimiters.

DATETIME MM-DD-YY (for example, 01-17-92)
MMM-DD-YY (for example, Jan-17-92)
DD-MMM-YY (for example, 17-Jan-92)
YYYY-MM-DD (for example, 1992-01-17)
YYYY-MMM-DD (for example, 1992-Jan-17)

Mixed date separators are not allowed within a table.

The Text ISAM formats a DATETIME field in the American or European format, depending upon the International setting in the Windows Control Panel.

FLOAT The maximum width includes the sign and decimal point. In Schema.ini, the width is denoted as follows:

14.083 is FLOAT Width 6
-14.083 is FLOAT Width 7
+14.083 is FLOAT Width 7
14083. is FLOAT Width 6

ODBC always returns 8 for FLOAT columns.

FLOAT columns can also be in scientific notation, for example:

-3.04E+2 is Float Width 8
25E4 is Float Width 4

Note   Decimal and scientific notation cannot be mixed in a column.

NULL values are represented by a blank padded string in fixed-length files, and are omitted in delimited files.

Float data can be padded with leading blanks.

INTEGER Valid values for INTEGER columns are 32767 to -32766.

In Schema.ini, the width is denoted as follows:

14083 is INTEGER Width 5
0 is INTEGER Width 1

ODBC always returns 4 for INTEGER columns.

The maximum width includes a sign. The maximum width of an INTEGER column is 11, although the width can be greater due to blanks that are allowed in fixed-format tables.

LONGCHAR The theoretical limit on the width of a LONGCHAR column in either a fixed-length or delimited table is 65500K. The Text ISAM is more likely to provide reliable support up to about 32K.

More limitations on data types can be found in Data Type Limitations.