Difference between Money and (Float or Decimal) Datatype

  • What is the difference between Money and (Float or Decimal) Datatype. If we use Float or Decimal instead of Money, will we loose any functions..?

  • Money can take upto 5 decimal. Whereas, if you need > 5 decimal places for a value go for decimal(n,m)

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • nagesh.prasad (1/16/2013)


    What is the difference between Money and (Float or Decimal) Datatype. If we use Float or Decimal instead of Money, will we loose any functions..?

    Money and Decimal are fixed numeric datatypes while Float is an approximate numeric datatype. Results of mathematical operations on floating point numbers can seem unpredictable, especially when rounding is involved. Be sure you understand the significance of the difference before you use Float!

    Also, Money doesn't provide any advantages over Decimal. If fractional units up to 5 decimal places are not valid in your currency or database schema, just use Decimal with the appropriate precision and scale.

    Jason Wolfkill

  • The Decimal, Double, and Float variable types are different in the way that they store the values. Precision is the main difference where float is a single precision (32 bit) floating point data type, double is a double precision (64 bit) floating point data type and decimal is a 128-bit floating point data type.

    Float - 32 bit (7 digits)

    Double - 64 bit (15-16 digits)

    Decimal - 128 bit (28-29 significant digits)

    More about.....Decimal vs Double vs Float

    Lynda

  • wolfkillj (1/18/2013)


    nagesh.prasad (1/16/2013)


    Also, Money doesn't provide any advantages over Decimal.

    Except when working with SSAS. Analysis Services doesn't know decimal, it only knows float and money. So if you need a precision less than 5, you better use money because it saves you a lot of expensive conversion (decimal to float) when SSAS is processing data.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply