I need to store currency exchange rate data in the SQL 2008 database.
I would like to keep rate as a decimal
data type in the database.
One thing I am not sure about, is how many decimal places to give (e.g. decimal(18, ?)).
Since, I will be using this service as a source: http://openexchangerates.org/latest.json. There, it seems that the highest number of decimal places used is '6'.
Is that the right number, or there possibly can be rates with more than 6 decimal places?
Maximum length of decimal places is 17 digits and minimum value can be 0 digit.
Most currencies have two decimals. Some currencies do not have decimals, and some have three decimals.
Quick answer: Bahraini and Kuwaiti Dinars. Both these countries' currency are called Dinar, and it is made up of 1000 fils. Although the Kuwaiti Dinar is stronger, by 25% so that 1 Kuwaiti Dinar equals 1.250 Bahraini Dinar; the Bahraini Dinar is no lightweight.
4 decimal places is standard in financial applications that calculate interest. The results are typically then rounded to 2 decimal places for practical purposes. Thanks for the link to Bankers Rounding .
I once worked on an international financial C# based package, which had to support numerous currencies, and we supported 6 decimal places. We had a couple of very experienced designers who told us that would be sufficient.
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