Microsoft KB Archive/258871

= XL2000: Data Truncated When You Get External Sybase Data =

Article ID: 258871

Article Last Modified on 9/25/2003

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q258871





SYMPTOMS
When you return data to your Microsoft Excel worksheet, data appears randomly truncated, for example:   Data on server                   Same data in Microsoft Excel --

Texas, Irving                   Texas, Washington, Seattle             Washingto North Carolina, Charlotte       North Caroli



CAUSE
This problem occurs when you return data to Microsoft Excel 2000 from Sybase Adaptive Server Anywhere version 6.03.

-and-

The Sybase Open Database Connectivity (ODBC) driver is Dbodbc6.dll, version 6.00.03.2747, dated 8/5/99.



RESOLUTION
This problem no longer occurs in Excel version 2000 and Sybase Adaptive Server Anywhere version 6.03 EBF (emergency bug fix) #2984 or later.

Contact the vendor of your Sybase ODBC driver for an updated ODBC driver.



MORE INFORMATION
This data truncation is a result of a problem with translating the ODBC data type to its equivalent data size. Excel 2000 uses SQLBindCol to bind columns as double-byte characters (two bytes per character), in order to handle Unicode characters.

Earlier versions of Excel bind columns as single-byte characters, because they only expect ANSI characters. The problem occurs when the ODBC SQLBindCol function receives an incorrect value for the number of bytes of data. Specifically, if the driver gives Excel the string size instead of the byte size, the data is cut in half.

For example, the word Washington is 10 characters long and needs 20 bytes (double bytes). The SQLBindCol function expects to receive the value 20. 10 characters at 2 bytes per character equals 20 bytes. However, if the ODBC driver returns the string length (10) instead of the number of bytes (20), Excel considers the string length to be 5 (10 divided by 2) and truncates the word Washington to Washi.

The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

