Data Formats

ODBC Test accepts data in the following formats.

Data Type Valid Formats
Binary Hexadecimal. The value must contain an even number of hexadecimal characters. For example, 0x0100 is valid; 0xF is not.
Bit Decimal (0 to 255).

Hexadecimal (0x00 to 0xFF).

Character Character. For example, abc.

Hexadecimal. The value must contain an even number of hexadecimal characters. For example, 0x 61 62 63 is legal; 0x616 is not.

Date YYYY-MM-DD. For example, 1993-10-25.

Hexadecimal. The hexadecimal characters match the SQL_DATE_STRUCT structure. You must enter exactly 12 hexadecimal characters. For example, 0x 07C9 000A 0019.

Floating Point Decimal. For example, 1234.46.

Scientific notation. For example, 1.23446E3.

Hexadecimal. The value must contain the exact number of hexadecimal characters required by the floating-point data type. For example, type 0xA64E9A44 for the SFLOAT 1234.46 and type 0x1D5A643BDFD98E40 for the SDOUBLE 987.234.

Integer Decimal. For example, 255.

Hexadecimal. The value can contain any number of hexadecimal characters up to the length of the integer. For example, 0xFF or 0xF.

Interval Interval data is entered in one of the 13 interval formats: year, month, day, hour, minute, second, year to month, day to hour, day to minute, day to second, hour to minute, hour to second, or minute to second. The length of the data depends upon the interval leading precision (for a single-field interval or the first field of a two-field interval) or the seconds precision (for the second field of a two-field interval when that field includes a seconds component). The interval leading precision is defined in the SQL_DESC_DATETIME_INTERVAL_PRECISION descriptor field; the seconds precision is determined by the SQL_DESC_PRECISION descriptor field. The number of digits in the month, day, or hour component of the second field of a two-field interval is determined by the constraints of the Gregorian calendar. Interval data is entered as follows:

Year, month, day, hour, minute, second: nnn (with the number of digits determined by the interval leading precision).

Year to month: yyy-mm (with the number of year digits determined by the interval leading precision; and two month digits).

Day to hour: ddd hh (with the number of day digits determined by the interval leading precision; and two hour digits).

Day to minute: ddd hh:mm (with the number of day digits determined by the interval leading precision; two hour digits and two minute digits).

Day to second: ddd hh:mm:ss.fff (with the number of day digits determined by the interval leading precision; two hour digits, two minute digits, two second digits; and the number of fractional seconds digits determined by the seconds precision).

Hour to minute: hhh:mm (with the number of hour digits determined by the interval leading precision; and two minute digits).

Hour to second: hhh:mm:ss.fff (with the number of hour digits determined by the interval leading precision; two minute digits; two second digits; and the number of fractional seconds digits determined by the seconds precision).

Minute to second: mmm:ss.fff (with the number of minute digits determined by the interval leading precision; two second digits; and the number of fractional seconds digits determined by the seconds precision).

For more information about interval literals, see “Interval Literals” in Appendix D, “Data Types”, of the ODBC 3.0 Programmer’s Reference.

Time HH:MM:SS. For example, 12:34:56.

Hexadecimal. The hexadecimal characters match the SQL_TIME_STRUCT structure. You must enter exactly 12 hexadecimal characters. For example, 0x 000C 0022 0038.

Timestamp YYYY-MM-DD (time is set to 0). For example, 1993-10-25.

HH:MM:SS (date is set to current date). For example, 12:34:56.

YYYY-MM-DD HH:MM:SS[.F...]. For example, 1993-10-25 12:34:56.

Hexadecimal. The hexadecimal characters match the SQL_TIMESTAMP_STRUCT structure. If you specify the fractional part of a timestamp, you must enter exactly 32 hexadecimal characters. If you do not specify the fractional part of a timestamp, you must enter exactly 24 hexadecimal characters. For example, 0x 07C9 000A 0019 000C 0022 0038 0000 0000 (with the fractional part) or 0x 07C9 000A 0019 000C 0022 0038 (without the fractional part).


Hexadecimal values are subject to the following constraints: