What is preferable data type to store the costing value ? Money or Decimal whats the programmatic diff bet them? asp.net Data Annotation for asp.net Model for Money data type ?
"The MONEY data type could result in unintentional loss of precision from rounding errors. It's better to use the DECIMAL data type."
If you need the highest precision, a DECIMAL can use up to 17 bytes for each value. Generally though, I like using DECIMAL(19,4) for currency, which needs 9 bytes and can store numbers 19 digits wide, where the last four digits are after the decimal place.
The MONEY data type stores currency amounts. TLike the DECIMAL(p,s) data type, MONEY can store fixed-point numbers up to a maximum of 32 significant digits, where p is the total number of significant digits (the precision) and s is the number of digits to the right of the decimal point (the scale).
Money is stored in the same way an integer is stored, whereas decimal is stored as a decimal point and decimal digits. This means that money will drop accuracy in most cases, while decimal will only do so when converted back to its original scale. Money is fixed point, so its scale doesn't change during calculations.
You should prefer decimal
as money
datatype is not precise.
You may also check Performance / Storage Comparisons : MONEY vs. DECIMAL by Aaron Bertrand
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With