Tim Bunce wrote: > [...] > > Note that DATETIME_SUB is misspelled with > an SQL_ prefix in the docs. That's wrong. Fixed now.
Really? <http://msdn.microsoft.com/library/en-us/odbc/htm/odbcsqlgettypeinfo.asp?frame=false> [...] > > 2. What does the DATA_TYPE field contain when this field contains > > SQL_DATETIME or SQL_INTERVAL? Not that value - but which value? > > The "consise" type integer, ie 112 for SQL_INTERVAL_HOUR_TO_SECOND. > So when SQL_DATA_TYPE = SQL_DATETIME or SQL_INTERVAL then > DATA_TYPE == DATETIME_SUB. (Yes, DATETIME_SUB does seem redundant > but that's what the ODBC spec calls for.) IMO, there is a hidden rule for interval or datetime data types: DATA_TYPE == 10 * SQL_DATA_TYPE + SQL_DATETIME_SUB e.g.: SQL_INTERVAL_HOUR_TO_SECOND == 10 * SQL_INTERVAL + SQL_CODE_HOUR_TO_SECOND 112 == 10 * 10 + 12 SQL_TYPE_TIMESTAMP == 10 * SQL_DATETIME + SQL_CODE_TIMESTAMP 93 == 10 * 9 + 3 Steffen