Microsoft Knowledge Base Email Alertz

(237492) - When using the OLEDB provider for ODBC, numeric data types returned from the database are returned with the trailing zeros to the left of the decimal place truncated. For example: 100 would be returned as 1. 2200 would be returned as 22.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 237492 - Last Review: September 22, 2005 - Revision: 2.2

FIX: Trailing Zeros Truncated with ADO OLEDB Provider for ODBC

This article was previously published under Q237492

SYMPTOMS

When using the OLEDB provider for ODBC, numeric data types returned from the database are returned with the trailing zeros to the left of the decimal place truncated.

For example:

100 would be returned as 1.

2200 would be returned as 22.

CAUSE

This data truncation is a result of a problem with the translation of the ODBC data type to its equivalent OLEDB data type. This problem occurs when the ODBC driver being used returns a negative value for the scale element of the SQL_C_NUMERIC structure.

RESOLUTION

This has been confirmed to be a bug in the MDAC components. There is a fix for this problem which is discussed in the STATUS section of this article. In addition to this fix, there are several other workarounds to this problem:
  • Modify the query that brings back the numeric type so that the numeric type is converted to strings before returning. For example, "SELECT convert(char(10),field1) FROM TABLENAME."
  • Use the ADO client cursor library instead. This can be done by specifying Connection.CursorLocation = adUseClient.
  • Use the native OLEDB provider for the database, if one is available.

STATUS

This problem has been fixed in Microsoft ActiveX Data Objects versions 2.5 and later. The fix for this issue is available in MDAC 2.5.

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
195470  (http://kbalertz.com/Feedback.aspx?kbNumber=195470/EN-US/ ) PRB: MDAC 2.0 ODBC Requirements for Numeric Fields
ODBC 3.0 Programmer's Reference

APPLIES TO
  • Microsoft OLE DB Provider for ODBC 2.0
  • Microsoft Data Access Components 2.1 Service Pack 2
Keywords: 
kbhotfixserver kbqfe kb3rdparty kbbug kbdatabase kbfix kbmdac210sp2fix kbmdac250fix kbmdacnosweep kboledb210fix KB237492
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate