Example SQLGetTypeInfo Result Set
Article 02/28/2023
6 contributors
Feedback
In this article
An application calls SQLGetTypeInfo to determine which data types are supported by a data source and the characteristics of those data types. The following tables show a sample result set returned by SQLGetTypeInfo for a data source that supports SQL_CHAR, SQL_LONGVARCHAR, SQL_DECIMAL, SQL_REAL, SQL_DATETIME, SQL_INTERVAL_YEAR, and SQL_INTERVAL_DAY_TO_SECOND.
TYPE_NAME
DATA_TYPE
COLUMN_SIZE
LITERAL_PREFIX
LITERAL_SUFFIX
CREATE_PARAMS
NULLABLE
"char"
SQL_CHAR
255
"'"
"'"
"length"
SQL_TRUE
"text"
SQL_LONGVARCHAR
2147483647
"'"
"'"
<Null>
SQL_TRUE
"decimal"
SQL_DECIMAL
28
<Null>
<Null>
"precision, scale"
SQL_TRUE
"real"
SQL_REAL
7
<Null>
<Null>
<Null>
SQL_TRUE
"datetime"
SQL_TYPE_TIMESTAMP
23
"'"
"'"
<Null>
SQL_TRUE
"INTERVAL YEAR() TO YEAR"
SQL_INTERVAL_YEAR
9
"'"
"'"
"precision"
SQL_TRUE
"INTERVAL DAY() TO FRACTION(5)"
SQL_INTERVAL_DAY_TO_SECOND
24
"'"
"'"
"precision"
SQL_TRUE
DATA_TYPE
CASE_SENSITIVE
SEARCHABLE
UNSIGNED_ATTRIBUTE
FIXED_PREC_SCALE
AUTO_UNIQUE_VALUE
LOCAL_TYPE_NAME
SQL_CHAR
SQL_FALSE
SQL_SEARCHABLE
<Null>
SQL_FALSE
<Null>
"char"
SQL_LONGVARCHAR
SQL_FALSE
SQL_PRED_CHAR
<Null>
SQL_FALSE
<Null>
"text"
SQL_DECIMAL
SQL_FALSE
SQL_PRED_BASIC
SQL_FALSE
SQL_FALSE
SQL_FALSE
"decimal"
SQL_REAL
SQL_FALSE
SQL_PRED_BASIC
SQL_FALSE
SQL_FALSE
SQL_FALSE
"real"
SQL_TYPE_TIMESTAMP
SQL_FALSE
SQL_SEARCHABLE
<Null>
SQL_FALSE
<Null>
"datetime"
SQL_INTERVAL_YEAR
SQL_FALSE
SQL_SEARCHABLE
<Null>
SQL_FALSE
<Null>
"INTERVAL YEAR() TO YEAR"
SQL_INTERVAL_DAY_TO_SECOND
SQL_FALSE
SQL_PRED_BASIC
<Null>
SQL_FALSE
<Null>
"INTERVAL DAY() TO FRACTION(5)"
DATA_TYPE
MINIMUM_SCALE
MAXIMUM_SCALE
SQL_DATA_TYPE
SQL_DATETIME_SUB
NUM_PREC_RADIX
INTERVAL_PRECISION
SQL_CHAR
<Null>
<Null>
SQL_CHAR
<Null>
<Null>
<Null>
SQL_LONGVARCHAR
<Null>
<Null>
SQL_LONGVARCHAR
<Null>
<Null>
<Null>
SQL_DECIMAL
0
28
SQL_DECIMAL
<Null>
10
<Null>
SQL_REAL
<Null>
<Null>
SQL_REAL
<Null>
10
<Null>
SQL_TYPE_TIMESTAMP
3
3
SQL_DATETIME
SQL_CODE_TIMESTAMP
<Null>
12
SQL_INTERVAL_YEAR
0
0
SQL_INTERVAL
SQL_CODE_INTERVALYEAR
<Null>
9
SQL_INTERVAL_DAY_TO_SECOND
5
5
SQL_INTERVAL
SQL_CODE_INTERVALDAY_TO_SECOND
<Null>
9