Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Money or Decimal datatype?

Money or Decimal datatype?

Scheduled Pinned Locked Moved Database
csharpdatabasewpfhelpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VisualLive
    wrote on last edited by
    #1

    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. :)

    N 1 Reply Last reply
    0
    • V VisualLive

      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. :)

      N Offline
      N Offline
      Niladri_Biswas
      wrote on last edited by
      #2

      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

      V 1 Reply Last reply
      0
      • N Niladri_Biswas

        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

        V Offline
        V Offline
        VisualLive
        wrote on last edited by
        #3

        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. :)

        N 1 Reply Last reply
        0
        • V VisualLive

          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. :)

          N Offline
          N Offline
          Niladri_Biswas
          wrote on last edited by
          #4

          :)

          Niladri Biswas

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups