Unlike the "concise" SQL and C data types, where each identifier refers to a single data type, descriptors do not in all cases use a single value to identify data types. In some cases, descriptors use a verbose data type and a type subcode. For most data types, the verbose data type identifier matches the concise type identifier.
The exception, however, is the datetime and interval data types. For these data types:
▪SQL_DESC_TYPE contains the verbose type (SQL_DATETIME)
▪SQL_DESC_CONCISE_TYPE contains a concise type
For details on setting fields and a setting’s effect on other fields, see the SQLSetDescField function description on the Microsoft ODBC web site.
When the SQL_DESC_TYPE or SQL_DESC_CONCISE_TYPE field is set for some data types, the following fields are set to default values appropriate for the data type:
▪SQL_DESC_DATETIME_INTERVAL_PRECISION
▪SQL_DESC_LENGTH
▪SQL_DESC_PRECISION
▪SQL_DESC_SCALE
For more information, see the SQL_DESC_TYPE field under SQLSetDescField function description on the Microsoft ODBC web site.
If the default values set are not appropriate, you can explicitly set the descriptor field in the application by calling SQLSetDescField.
The following table lists for each SQL and C type identifier, the concise type identifier, verbose identifier, and type subcode for each datetime.
For datetime data types, the SQL_DESC_TYPE have the same manifest constants for both SQL data types (in implementation descriptors) and for C data types (in application descriptors):
Concise type identifier, verbose identifier, and type subcode for each datetime
Concise SQL type
Concise C type
Verbose type
DATETIME_INTERVAL_CODE (also called "type subcode")
SQL_TYPE_DATE
SQL_C_TYPE_DATE
SQL_DATETIME
SQL_CODE_DATE
SQL_TYPE_TIME
SQL_C_TYPE_TIME
SQL_DATETIME
SQL_CODE_TIME
SQL_TYPE_TIMESTAMP
SQL_C_TYPE_TIMESTAMP
SQL_DATETIME
SQL_CODE_TIME STAMP
Pseudo-type identifiers
ODBC defines a number of pseudo-type identifiers, which depending on the situation, resolve to existing data types. Tthese identifiers do not correspond to actual data types, but are provided for your application programming convenience.