Datatypes
The classes RWDBColumn and RWDBValue have an associated RWDBValue::ValueType that specifies the datatype of the database column or field being referenced. Mapping between this datatype and the database vendor type runs in both directions:
*When fetching data or retrieving information about tables, the DB Access Module for Microsoft SQL Server converts the SQL type code provided by the Microsoft SQL Server ODBC driver into RWDBValue::ValueTypes. This mapping is shown in Table 1, which also gives the C++ datatype corresponding to the RWDBValue::ValueType.
*When creating tables, the DB Access Module for Microsoft SQL Server maps the given RWDBValue::ValueType directly to the Microsoft SQL Server datatype. This mapping is shown in Table 2.
The RWDBValue::ValueTypes, accessible through the type() method, are uniform across all Access Modules. For a complete explanation of the DB Interface Module data model, see Chapter 7, "The Data Model," in the DB Interface Module User’s Guide, and RWDBValue in the SourcePro API Reference Guide.
NOTE: We update the mapping tables regularly, but Rogue Wave cannot be responsible for changes made by other vendors. For the latest information on mappings between the Microsoft SQL Server SQL symbolic datatypes and the actual SQL datatypes used on the database, please consult Microsoft's SQL Server Library documentation.
Table 1 – Datatype mapping when retrieving data 
SQL Server Datatype
ODBC SQL Datatype
RWDBValue:: ValueType
C++ Datatype
char(n)
varchar(n)
text
SQL_CHAR
SQL_VARCHAR
SQL_LONGVARCHAR
String
nchar(n)
nvarchar(n)
ntext
SQL_WCHAR
SQL_WVARCHAR
SQL_WLONGVARCHAR
UString
binary(n)
varbinary(n)
image
SQL_BINARY
SQL_VARBINARY
SQL_LONGVARBINARY
Blob
bit
SQL_BIT
UnsignedChar
unsigned char
tinyint
SQL_TINYINT
UnsignedChar
unsigned char
smallint
SQL_SMALLINT
Short
short int
bigint
SQL_BIGINT
LongLong
long long
int
SQL_INTEGER
Long/UnsignedLong
(32-bit architectures)
Int/UnsignedInt
(64-bit architectures)
long int / unsigned long int
(32-bit architectures)
int / unsigned int
(64-bit architectures)
float(p)
SQL_FLOAT
Double
double
real
SQL_REAL
Float
float
decimal(p,s)
money
smallmoney
SQL_DECIMAL
Decimal
timestamp
SQL_BINARY
Blob
datetime
smalldatetime1
SQL_TYPE_TIMESTAMP
DateTime

1 Values of type datetime and smalldatetime are affected by the time zone setting on either RWDBDatabase or RWDBConnection while sending and retrieving data. The time zone setting can be set programmatically with the timeZone() method in each of these classes.

Table 2 – Datatype mapping when creating tables
RWDBValue:: ValueType
SQL Server Datatype
Blob
if 0 < length <= 8000 varbinary using the storageLength of the RWDBColumn, otherwise image
Char
UnsignedChar
Tiny
UnsignedTiny
tinyint
Date
DateTime
datetime
Decimal
decimal(p,s) using precision and scale of the RWDBColumn supplied, otherwise decimal(8, 0)
Duration
Not supported by Microsoft SQL Server
Float
real
Double
float
Int
UnsignedInt
smallint
LongDouble
Not supported by Microsoft SQL Server
Long
UnsignedLong
int
Short
UnsignedShort
smallint
String
if 0 < length <= 8000 bytes, varchar using the storageLength of the RWDBColumn, otherwise text
UString
MBString
WString
if 0 < length <= 4000 bytes, nvarchar using the storageLength of the RWDBColumn, otherwise ntext
LongLong
UnsignedLongLong
bigint