Need T-SQL to omit right hand decimal places

  • Getting an arithmetic overflow operation error. Looking for T-SQL to limit my output to 5 decimal places to the right:

    SELECT Col_1 / Col_2 FROM Tab_A

    Example: SELECT 614668.29 / 5593945.68 -- (which equals 0.109880990120)

    Needs to be rendered as 0.010988

    BT
  • This was a recent hot topic - take a look here:

    http://www.sqlservercentral.com/Forums/Topic403180-338-1.aspx

    For what it's worth - not sure what's causing your overflow error (unless there's a divide by 0 erro going on). Running too many digits past the decimal point should not cause that.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Modified to: SELECT CAST((Col_1 / Col_2) as DECIMAL(9,5))

    Worked like a champ.

    BT

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

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