Round a number to lower bound

  • Hi All,

    Would like to round number to lower bound instead of upper bound in SQL.

    Example: round(xxx.555,2) is retruning xxx.56. I want get result as xxx.55.

    Thanks in Advance.

  • Look at the function FLOOR()


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Thank you for your quick response.

    Floor will give me the lowe bound with out decimals.

    I want the lower bound in decimal part.

    Would like to see 113.555 as 113.55 instead of 113.56.

  • FLOOR(113.555 * 100) / 100

  • Bhogadi (6/29/2011)


    Hi All,

    Would like to round number to lower bound instead of upper bound in SQL.

    Example: round(xxx.555,2) is retruning xxx.56. I want get result as xxx.55.

    Thanks in Advance.

    Please lookup the 3rd operand of ROUND in Books Online. It's one of those things that people read about and forget.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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