Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004

    Unanswered: scale of money data type in output file

    I have some data that I am outputting to a text file:


    where sales is datatype money. If I execute the query with query analyzer I get 4 decimals, but when it is output to a text file it rounds the number

    Grid Text File
    2182035.9600 2182035.96
    961799.2400 961799.24
    22104768.1850 22104768.185

    If I do cast or convert it to money it does the same thing.

    It really doesn't make a material difference for its intended use but I would like to keep it consistent with 4 decimals.

  2. #2
    Join Date
    Jun 2003
    Provided Answers: 1
    The money datatype stores data to four decimal places for accuracy of rounding and multiplication, but only displays two decimal places because, well, because we don't deal in anything less than pennies. That's why because.

    Cast the datatype to decimal (20,4) or some such thing if you really need four places.

    By the way, here is a little known fact: the maximum value that can be stored by the money datatype is exactly equal to Bill Gate's net worth. The more you know....
    If it's not practically useful, then it's practically useless.

    blindman "sqlblindman"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts