15.3.1 Correspondence between ODBC's SQL data types and HADB's data types
The following table shows the correspondence between ODBC's SQL data types and HADB's data types.
Classification |
ODBC's SQL data type |
HADB's corresponding data type |
Description |
Supported |
---|---|---|---|---|
Character string data |
SQL_CHAR |
CHARACTER |
Fixed-length character string |
Y |
SQL_VARCHAR |
VARCHAR |
Variable-length character string |
Y |
|
SQL_LONGVARCHAR |
-- |
Variable-length character string |
N |
|
SQL_WCHAR |
-- |
Fixed-length character string (for Unicode) |
N |
|
SQL_WVARCHAR |
-- |
Variable-length character string (for Unicode) |
N |
|
SQL_WLONGVARCHAR |
-- |
Variable-length character string (for Unicode) |
N |
|
Numeric data |
SQL_DECIMAL |
DECIMAL |
Fixed-point number |
Y |
SQL_NUMERIC |
-- |
Fixed-point number |
N |
|
SQL_TINYINT |
-- |
1-byte integer |
N |
|
SQL_SMALLINT |
-- |
2-byte integer |
Y#1 |
|
SQL_INTEGER |
SMALLINT |
4-byte integer |
Y |
|
SQL_BIGINT |
INTEGER |
8-byte integer |
Y |
|
SQL_REAL |
-- |
Single-precision floating point number |
N |
|
SQL_FLOAT |
-- |
Double-precision floating-point number |
N |
|
SQL_DOUBLE |
DOUBLE PRECISION |
Double-precision floating-point number |
Y |
|
SQL_BIT |
-- |
Bit |
N |
|
SQL_BINARY |
BINARY |
Fixed-length binary data |
Y |
|
SQL_VARBINARY |
VARBINARY |
Variable-length binary data |
Y |
|
SQL_LONGVARBINARY |
-- |
Variable-length binary data |
N |
|
Date and time data |
SQL_TYPE_DATE(, SQL_DATE)#2 |
DATE |
Date |
Y |
SQL_TYPE_TIME(, SQL_TIME)#2 |
TIME |
Time |
Y |
|
SQL_TYPE_TIMESTAMP(, SQL_TIMESTAMP)#2 |
TIMESTAMP |
Time stamp |
Y |
|
SQL_INTERVAL_MONTH |
-- |
Interval in months |
N |
|
SQL_INTERVAL_YEAR |
-- |
Interval in years |
N |
|
SQL_INTERVAL_YEAR_TO_MONTH |
-- |
-- |
N |
|
SQL_INTERVAL_DAY |
-- |
Interval in days |
N |
|
SQL_INTERVAL_HOUR |
-- |
Interval in hours |
N |
|
SQL_INTERVAL_MINUTE |
-- |
Interval in minutes |
N |
|
SQL_INTERVAL_SECOND |
-- |
Interval in seconds |
N |
|
SQL_INTERVAL_DAY_TO_HOUR |
-- |
-- |
N |
|
SQL_INTERVAL_DAY_TO_MINUTE |
-- |
-- |
N |
|
SQL_INTERVAL_DAY_TO_SECOND |
-- |
-- |
N |
|
SQL_INTERVAL_HOUR_TO_MINUTE |
-- |
-- |
N |
|
SQL_INTERVAL_HOUR_TO_SECOND |
-- |
-- |
N |
|
SQL_INTERVAL_MINUTE_TO_SECOND |
-- |
-- |
N |
|
Other |
SQL_GUID |
-- |
-- |
N |
- Legend:
-
--: There is no corresponding data type.
Y: The data type can be used.
N: The data type cannot be used.
- #1
-
Because HADB does not have a data type that corresponds to SQL_SMALLINT, you cannot use SQL_SMALLINT to access the HADB database. SQL_SMALLINT can be used as an interface for some of the catalog functions provided by the HADB ODBC driver. For example, SQL_SMALLINT can be used in the value of SQL_DATA_TYPE in the result set column of SQLColumns.
- #2
-
SQL_TYPE_DATE, SQL_TYPE_TIME, and SQL_TYPE_TIMESTAMP are the datetime data types used in ODBC 3.0. Use these data types unless you have a reason not to.
The data types in parentheses are the datetime data types for ODBC 2.0. They are handled in the same way as those for ODBC 3.0. Depending on the value specified for the ADBODBAPMODE environment variable, the identifier in parentheses might be returned in metadata.