Convert money to numeric

  • If I change money to numeric in the table, will I loose any data?

    Thank you

  • Not if you specify the correct precision and scale. For example, numeric(10,2).

  • The money type has four decimal places, so to ensure no data loss numeric(10,4) would be more appropriate.

    Bob
    -----------------------------------------------------------------------------
    How to post to get the best help[/url]

  • Click here for more info on the money data type.

  • Robert klimes (6/10/2009)


    The money type has four decimal places, so to ensure no data loss numeric(10,4) would be more appropriate.

    Good catch! Missed that 🙂

  • Ok, I changed from money to numeric(10,4). Before data looked $967.69 and now 967.0000.What is the solution?Thank you

  • What's the problem?

  • What exactly did you do? I just ran a quick test using a temp table and had no problem.

    What result does this query yield in your environment?

    SELECT CAST(967.69 AS NUMERIC(10,4))

  • Thank you, it is working, Can I convert float to numeric?

  • I have a suggestion, please make Books Online your friend.

    Let me help you with this one, just click here.

  • Krasavita (6/10/2009)


    Thank you, it is working, Can I convert float to numeric?

    Numeric is a fixed-point format. When converting a floating-point format to a fixed-point format, it is always possible that you will lose some precision.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Lynn Pettis (6/10/2009)


    I have a suggestion, please make Books Online your friend.

    Let me help you with this one, just click here.

    :laugh:

Viewing 12 posts - 1 through 11 (of 11 total)

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