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

Article translations Article translations
Article ID: 277716 - View products that this article applies to.
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)
Expand all | Collapse all


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.


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.


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
  • Use the Microsoft OLE DB Provider for ODBC (MSDASQL) and the DB2 ODBC driver instead of the OLE DB Provider for DB2 (DB2OLEDB).


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.


Article ID: 277716 - Last Review: October 21, 2013 - Revision: 4.1
  • Microsoft SQL Server 7.0 Standard Edition
kbnosurvey kbarchive kbbug kbfix kbqfe KB277716

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from