Some applications/tools are using Integers to Store money/currency values.
Similar built-in implementation for such Currency/Money Data Types is
available in MS SQL Server and also in Visual Basic For Applications.

In such data types, data is stored as integer only (no decimal point is
stored). Some fix number of last digits say 2/3/4 are assumed for decimal
portion.

SQLite does not have built-in currence/money data type. But integer can be
used to store monetory values in similar way and handle related calculations
using similar concept. Will need you to handle decimal portion (fix number
of digits) properly while storing/retrieving as well as in calculations.

Hope this helps.

Rohit


Reference Info from MSDN Library
================================
Microsoft SQL Server 2000
-> money and smallmoney data types

Monetary data - represents positive or negative amounts of money. In
Microsoft SQL Server 2000, monetary data is stored using the money and
smallmoney data types. Monetary data can be stored to an accuracy of four
decimal places. Use the money data type to store values in the range from
-922,337,203,685,477.5808 through +922,337,203,685,477.5807 (requires 8
bytes to store a value). Use the smallmoney data type to store values in the
range from -214,748.3648 through 214,748.3647 (requires 4 bytes to store a
value). If a greater number of decimal places are required, use the decimal
data type instead.


Visual Basic For Applications
-> Currency Data Type

Currency variables are stored as 64-bit (8-byte) numbers in an integer
format, scaled by 10,000 to give a fixed-point number with 15 digits to the
left of the decimal point and 4 digits to the right. This representation
provides a range of -922,337,203,685,477.5808 to 922,337,203,685,477.5807.
The type-declaration character for Currency is the at sign (@). The Currency
data type is useful for calculations involving money and for fixed-point
calculations in which accuracy is particularly important.



Mikey C wrote:
> 
> Hi there,
> 
> Currently I am using a SQLite 3.x database that stores and calculates
> currency values using the column type NUMERIC (which I believe has a FLOAT
> affinity).
> 
> However this leads to errors in storing values values in floating point
> representation.
> 
> I guess there is no planned support for direct fixed point types, so what
> is the best approach?
> 
> Store the monetary values in an INTEGER column and multiply all values up
> by 100 to store in pence/cents?
> 
> Any advice?
> 
> Thanks,
> 
> Mike
> 

-- 
View this message in context: 
http://www.nabble.com/Storing-monetary-values-and-calculations-tf4264034.html#a12323492
Sent from the SQLite mailing list archive at Nabble.com.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to