Table 1-1 describes the Adaptive Server ODBC Driver datatype mappings.
ASE datatype |
ODBC SQL datatype |
ODBC bind datatype |
---|---|---|
bigdatetime |
SQL_TYPE_TIMESTAMP |
SQL_C_TYPE_TIMESTAMP or SQL_C_CHAR |
bigtime |
SQL_TYPE_TIME |
SQL_C_TYPE_TIME or SQL_C_CHAR |
bigint |
SQL_BIGINT |
SQL_C_BIGINT |
binary |
SQL_BINARY |
SQL_C_BINARY |
bit |
SQL_BIT |
SQL_C_BIT |
char |
SQL_CHAR |
SQL_C_CHAR |
date |
SQL_TYPE_DATE |
SQL_C_TYPE_DATE or SQL_C_CHAR |
datetime |
SQL_TYPE_TIMESTAMP |
SQL_C_TYPE_TIMESTAMP or SQL_C_CHAR |
decimal |
SQL_DECIMAL |
SQL_C_NUMERIC or SQL_C_CHAR |
double |
SQL_DOUBLE |
SQL_C_DOUBLE |
float(<16) |
SQL_REAL |
SQL_C_FLOAT |
float(>=16) |
SQL_DOUBLE |
SQL_C_DOUBLE |
image |
SQL_LONGVARBINARY |
SQL_C_BINARY |
image_locator |
SQL_IMAGE_LOCATOR |
SQL_C_ IMAGE_LOCATOR |
int[eger] |
SQL_INTEGER |
SQL_C_LONG |
money |
SQL_DECIMAL |
SQL_C_NUMERIC or SQL_C_CHAR |
nchar |
SQL_CHAR |
SQL_C_CHAR |
nvarchar |
SQL_VARCHAR |
SQL_C_CHAR |
numeric |
SQL_NUMERIC |
SQL_C_NUMERIC or SQL_C_CHAR |
real |
SQL_REAL |
SQL_C_FLOAT |
smalldatetime |
SQL_TYPE_TIMESTAMP |
SQL_C_TYPE_TIMESTAMP or SQL_C_CHAR |
smallint |
SQL_SMALLINT |
SQL_C_SHORT |
smallmoney |
SQL_DECIMAL |
SQL_C_NUMERIC or SQL_C_CHAR |
text |
SQL_LONGVARCHAR |
SQL_C_CHAR |
text_locator |
SQL_TEXT_LOCATOR |
SQL_C_TEXT_LOCATOR |
time |
SQL_TYPE_TIME |
SQL_C_TYPE_TIME or SQL_C_CHAR |
timestamp |
SQL_BINARY |
SQL_C_BINARY |
tinyint |
SQL_TINYINT |
SQL_C_TINYINT |
unichar |
SQL_WCHAR |
SQL_C_CHAR |
unitext |
SQL_WLONGVARCHAR |
SQL_C_CHAR |
unitext_locator |
SQL_UNITEXT_LOCATOR |
SQL_C_ UNITEXT_LOCATOR |
univarchar |
SQL_WVARCHAR |
SQL_C_CHAR |
unsignedbigint |
SQL_BIGINT |
SQL_C_UBIGINT |
unsignedint |
SQL_INTEGER |
SQL_C_ULONG |
unsignedsmallint |
SQL_SMALLINT |
SQL_C_USHORT |
varbinary |
SQL_VARBINARY |
SQL_C_BINARY |
varchar |
SQL_VARCHAR |
SQL_C_CHAR |
When you use the Adaptive Server datatypes unichar, univarchar, and unitext, and then bind any of them to SQL_C_CHAR, the Adaptive Server ODBC Driver must convert the data from Unicode to multibyte and vice versa. For this conversion, it must have the SYBASE charsets installed in the $SYBASE directory. The installation program includes an option to install these charset files.
If the driver does not find the charsets, or if the $SYBASE environment variable is not set, then an appropriate error is propagated to the application. To install the SYBASE charsets, you must reinstall the ODBC Driver. See the Software Developer’s Kit and Open Server Installation Guide for your platform.
To support older applications, the Adaptive Server ODBC
Driver assumes that the default type is SQL_C_CHAR
when a unitext, univarchar,
or unichar column is bound as SQL_C_DEFAULT.
To bind as unicode, the application must explicitly
use a bind type of SQL_C_WCHAR.
When you use a column of type bigint as an identifier in an Adaptive Server table (for example, as an identity or primary key), and applications such as Microsoft Access accesses the table through Adaptive Server ODBC Driver, the values of such column may appear as “#deleted”, and prevent further operations on the table. As a workaround, set CHANGEBIGINTDEFAULT to 1.
CHANGEBIGINTDEFAULT values:
0 – the default value, binds SQL_C_DEFAULT to SQL_C_BIGINT.
1 – binds SQL_C_DEFAULT to SQL_C_CHAR. Use this setting when you want to access Adaptive Server tables with bigint identifiers from applications such as Microsoft Access or Microsoft Excel.
2 – binds SQL_C_DEFAULT to SQL_C_WCHAR.