Microsoft SQL Server ODBC-supported datatypes

Table B-2 identifies the supported Microsoft SQL Server datatypes and their corresponding ODBC datatypes.

Table B-2: Microsoft SQL datatypes and related ODBC datatypes

Microsoft SQL Server datatypes

ODBC datatypes

DATE

SQL_TYPE_DATE(91)

CHAR

SQL_WCHAR(1)

NUMERIC

SQL_WNUMERIC(2)

DECIMAL

SQL_WDECIMAL(3)

MONEY

SQL_WDECIMAL(3)

SMALLMONEY

SQL_WDECIMAL(3)

INT

SQL_WINTEGER(4)

SMALLINT

SQL_WSMALLINT(5)

FLOAT

SQL_WFLOAT(6)

REAL

SQL_WREAL(7)

VARCHAR

SQL_WVARCHAR(12)

TEXT

SQL_WLONGVARCHAR(-1)

TIMESTAMP

SQL_WBINARY(-2)

BINARY

SQL_WBINARY(-2)

VARBINARY

SQL_WVARBINARY(-3)

IMAGE

SQL_WLONGVARBINARY(-4)

TINYINT

SQL_WTINYINT(-6)

BIT

SQL_WBIT(-7)

*NCHAR

SQL_WCHAR(-8)

* NVARCHAR

SQL_WVARCHAR(-9)

* NTEXT

SQL_WLONGVARBINARY(-10)

TIMESTAMP

SQL_TYPE_TIMESTAMP(93)

DATETIME

SQL_TYPE_WTIMESTAMP(93)

SMALL DATETIME

SQL_TYPE_WTIMESTAMP(93)

* These datatypes are currently converted to single-byte ASCII.