Data Type Mappings

The SQL Server ODBC driver offers a richer set of data type mappings than any available Oracle ODBC driver.

SQL Server data type ODBC SQL data type
binary SQL_BINARY
bit SQL_BIT
char, character SQL_CHAR
datetime SQL_TIMESTAMP
decimal, dec SQL_DECIMAL
float, double precision, float(n)
for n = 8-15
SQL_FLOAT
image SQL_LONGVARBINARY
int, integer SQL_INTEGER
money SQL_DECIMAL
nchar SQL_WCHAR
ntext SQL_WLONGVARCHAR
numeric SQL_NUMERIC
nvarchar SQL_WVARCHAR
real, float(n) for n = 1-7 SQL_REAL
smalldatetime SQL_TIMESTAMP
smallint SQL_SMALLINT
smallmoney SQL_DECIMAL
sysname SQL_VARCHAR
text SQL_LONGVARCHAR
timestamp SQL_BINARY
tinyint SQL_TINYINT
uniqueidentifier SQL_GUID
varbinary SQL_VARBINARY
varchar SQL_VARCHAR

The timestamp data type is converted to the SQL_BINARY data type. This is because the values in timestamp columns are not datetime data, but rather binary(8) data. They are used to indicate the sequence of SQL Server activity on the row.

The Oracle data type mappings for the Microsoft ODBC driver for Oracle are shown in this table.

Oracle data type ODBC SQL data type
CHAR SQL_CHAR
DATE SQL_TIMESTAMP
LONG SQL_LONGVARCHAR
LONG RAW SQL_LONGVARBINARY
NUMBER SQL_FLOAT
NUMBER(P) SQL_DECIMAL
NUMBER(P,S) SQL_DECIMAL
RAW SQL_BINARY
VARCHAR2 SQL_VARCHAR

Oracle ODBC drivers from other vendors can have alternative data type mappings.