11 The SQL Server Native Wire Protocol Driver : Data Types

Data Types
Table 11-3 shows how the Microsoft SQL Server data types are mapped to the standard ODBC data types. “Unicode Support” lists Microsoft SQL Server to Unicode data type mappings.
 

1
Supported only on Microsoft SQL Server 2008 and higher.

2
Time mapping changes based on the setting of the
Fetch TWFS as Time option.

3
Supported only on Microsoft SQL Server 2005 and higher.

See “Retrieving Data Type Information” for information about retrieving data types.
Using the XML Data Type
By default, Microsoft SQL Server returns XML data to the driver encoded as UTF-8. To avoid data loss, an application must bind XML data as SQL_C_WCHAR. The driver then returns the data as either UTF-8 or UTF-16, depending on platform and application settings. If the application binds XML data as SQL_C_CHAR, the driver converts it to the client character encoding, possibly causing data loss or corruption. To prevent any conversion of XML data, the application must set the attribute XML Describe Type to SQL_LONGVARBINARY (-10) and bind the data as SQL_C_BINARY.