Money datatype

JO3Y
2007-09-07
2013-05-28
  • JO3Y
    JO3Y
    2007-09-07

    I was surprised to find that ValueTypes with Datatype Numeric:Money map to BigInt in the relational view.

    I can understand that Money is not quite a universal datatype, but until today I thought it was really a Float.

    From what I can find, Money is actually a 4 byte BigInt with an internally defined fixed decimal precision of .0000 in SQL Server.

    When I changed the ValueType to Decimal, it also maps to BigInt if scale is left at the default of 0, but maps to decimal(0,2) when I set the scale to '2' - then I found that Money also maps to decimal(0,2) when scale is '2'

    But if Money has a fixed precision of .0000, then maybe I need to set the scale to 4.

    My target is SQL Server 2005. Since I am going to have to search and replace all the relevent datatypes in the DDL (not all BigInt's, to be sure!) to change them to 'Money' - it seems that if only datatypes of Scale 4 are intended to be Money in my model, this might be the preferred route - or is there a better way?

    Joe

     
    • JO3Y
      JO3Y
      2007-09-11

      I have found that although a value type set to Money, Scale 4 shows in the relational view as BigInt, the DDL output targeted to SQLserver results in a datatype of Decimal, which, according to http://www.teratrax.com/sql_guide/data_types/sql_server_data_types.html is not equivalent to Money... For those interested.