Automatic decimal round off

  • VSSGeorge

    SSCrazy Eights

    Points: 8102

    Automatic decimal round off is happening for a column having datatype Decimal (6,2).

    I am entering 10.5 in the UI & it is rounding off & saved as 11.

    Should I change the datatype here to Nvarchar?

  • DesNorton


    Points: 22814

    NO.  DO NOT store decimals as varchar.

    Find the error in the code that is doing the rounding.  What data types are being used in the UI?

    Trace the call to the DB, and validate that the values are being passed as decimal, and not int.

  • MVDBA (Mike Vessey)


    Points: 21023

    have you run a sql profiler trace to see what the  client app is  trying to do - sounds like the UI is doing the rounding for you


  • Michael L John

    One Orange Chip

    Points: 25792

    This is a UI or coding issue, not a database issue.

    Decimal (6,2) is an pretty small number.  That can only hold +- 9999.99.

    10.5 assigned to a integer type in a programming language is likely rounding this number to 11.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:

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

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