INF: Translating DBMONEY Datatype into Actual Dollar Amount

Last reviewed: April 25, 1997
Article ID: Q67871

The information in this article applies to:
  • Microsoft SQL Server version 4.2 for OS/2
  • Microsoft SQL Server, version 4.2

SUMMARY

The following information explains how to translate the DBMONEY datatype, which is a structure containing 2 long INTs, to the dollar amount it represents.

MORE INFORMATION

The internal storage of the DBMONEY datatype keeps track of 1/100 of a cent, which equates to .0001 of a dollar. Therefore, you can have precision to four decimal places.

The high word unit is (2^32); this value is 4294967296.

If you enter 429496.7296 in a money field with ISQL and examine the low and high words after extracting the structure with a C program, you will see high=1, and low=0; therefore, the formula would be as follows:

   round(2, ((high*4294967296)+low) / 10000)

This would return $429,496.73.


Additional query words: DB-Library DB-Lib dblib
Keywords : kbprg SSrvGen SSrvServer SSrvWinNT
Version : 4.2 | 4.2
Platform : OS/2 WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.