FIX: OPENQUERY/OPENROWSET with DB2 Linked Server May Return Incorrect Results with Decimal Datatype

This article was previously published under Q277716
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 58467 (SQLBUG_70)
SYMPTOMS
Under the following conditions, use of the OPENQUERY or OPENROWSET function with a DB2 linked server may return decimal data with the decimal point incorrectly placed:
  • You use the Microsoft OLE DB provider for DB2 (DB2OLEDB).
  • The least significant digit (to the right of the decimal point) is zero (0).
For example, if the data type is DECIMAL(4,2) and the numeric value is 123.40, the OPENQUERY function incorrectly returns 12.34. However, if the value is 123.45, then the OPENQUERY function correctly returns 123.45.

The OPENROWSET function also exhibits the same symptoms.
CAUSE
The results from both the OPENQUERY and OPENROWSET functions are returned as rowsets from the provider. The data is then incorrectly retrieved from the rowsets.
WORKAROUND
To work around this problem, use one of these two methods:
  • Run a distributed query that uses the four-part naming convention for a DB2 linked server object. For example:
    Select * from LinkedServer.Catalog.Schema.TableName						
    -or-
  • Use the Microsoft OLE DB Provider for ODBC (MSDASQL) and the DB2 ODBC driver instead of the OLE DB Provider for DB2 (DB2OLEDB).
STATUS
Microsoft has confirmed this to be a problem in SQL Server 7. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server 7. For information about how to download and install the latest SQL Server Service Pack, see the following Microsoft Web site:For more information, contact your primary support provider.
distributed pass-through linked server
Properties

Article ID: 277716 - Last Review: 10/21/2013 02:53:21 - Revision: 4.1

  • Microsoft SQL Server 7.0 Standard Edition
  • kbnosurvey kbarchive kbbug kbfix kbqfe KB277716
Feedback