Money or Decimal datatype?
-
Hi all, i have a doubt about my database,i have a lot of currency fields in my database but i don't know(for my poor knowledge) which is the best option in my case to choose the right datatype money or decimal. I give you more detail when i finish the database i will use it with a software (WPF) and i must use many currency field to apply calculation,percentage,etc etc. so i need your help if you can advice me to choose the right datatype in my case. If you need more details don't hesitate to ask i will reply as soon as possible. Thanks so much. :)
-
Hi all, i have a doubt about my database,i have a lot of currency fields in my database but i don't know(for my poor knowledge) which is the best option in my case to choose the right datatype money or decimal. I give you more detail when i finish the database i will use it with a software (WPF) and i must use many currency field to apply calculation,percentage,etc etc. so i need your help if you can advice me to choose the right datatype in my case. If you need more details don't hesitate to ask i will reply as soon as possible. Thanks so much. :)
Money Data Type Money is compatible for currency with dollar and cent format. The datatype is accurate to 10 thousand times of the monetary unit. If the field is capable enough to store large aggregates rather than just the largest value, it is recommended to go with Money data type. Also with money, you have the choice to use thousand of separators. Decimal Data Type Decimal is more flexible, not specific to currency. Suppose you have to support 10 numbers and 2 decimals. In this context decimal is a better choice. Also, decimal is more precise( since we can set precision) and scale to numbers.
Coming to your question directly, what will be the datatype for calculation,percentage?
In case of percentage(e.g. 10.234), there is no case of currency involve. So decimal is the right choice.Also, you can apply precision over there. For the choice of calculation, you didn't specify, what kind of calculation it is! However, if is mathematical calculations of currency or any aggregation of the same(e.g. Add,Multiply etc. which will be in fraction), go with money datatype. :)
Niladri Biswas
modified on Tuesday, June 23, 2009 11:45 PM
-
Money Data Type Money is compatible for currency with dollar and cent format. The datatype is accurate to 10 thousand times of the monetary unit. If the field is capable enough to store large aggregates rather than just the largest value, it is recommended to go with Money data type. Also with money, you have the choice to use thousand of separators. Decimal Data Type Decimal is more flexible, not specific to currency. Suppose you have to support 10 numbers and 2 decimals. In this context decimal is a better choice. Also, decimal is more precise( since we can set precision) and scale to numbers.
Coming to your question directly, what will be the datatype for calculation,percentage?
In case of percentage(e.g. 10.234), there is no case of currency involve. So decimal is the right choice.Also, you can apply precision over there. For the choice of calculation, you didn't specify, what kind of calculation it is! However, if is mathematical calculations of currency or any aggregation of the same(e.g. Add,Multiply etc. which will be in fraction), go with money datatype. :)
Niladri Biswas
modified on Tuesday, June 23, 2009 11:45 PM
Hi Mr.Niladri, thanks for your useful answer i can understand better about Money And Decimal;
Niladri_Biswas wrote:
For the choice of calculation, you didn't specify, what kind of calculation it is! However, if is mathematical calculations of currency or any aggregation of the same(e.g. Add,Multiply etc. which will be in fraction), go with money datatype.
I need to do many and long calculations of currency as Add,Multiple,Divide and so on and if i understood well for this feature better choice money datatype. Have a good day. :)
-
Hi Mr.Niladri, thanks for your useful answer i can understand better about Money And Decimal;
Niladri_Biswas wrote:
For the choice of calculation, you didn't specify, what kind of calculation it is! However, if is mathematical calculations of currency or any aggregation of the same(e.g. Add,Multiply etc. which will be in fraction), go with money datatype.
I need to do many and long calculations of currency as Add,Multiple,Divide and so on and if i understood well for this feature better choice money datatype. Have a good day. :)
:)
Niladri Biswas