• idrisgani (7/2/2009)


    Thanks for the Reply. I have already tried with converting the real into decimal before converting to Varchar

    Declare @real real

    Set @real=Input

    print Round(Convert(varchar(30),Convert(Decimal(15,7),@real)),2)

    If Input = 19.005, expected Result is 19.01. but i cant able to reproduce the same. Actual result is 19

    i can able to achieve the result when Input = 19.0051( Result is 19.01).

    Based on that reply, I'm thinking that you didn't try Peso's code which actually does work. Don't assume that just reading the code will be your answer. Try it. 😉

    --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)