how to remove leading zeros after taking percentage

  • Hi all

    I have a query to get % from two summed columns it gives me correct % but the zeros are not going off, even if I use round function.

    here is the code

    select round(((555* 1.00) /1203) * 100 ,2)

    any help to remove these zeros...

    thanks

    [font="Comic Sans MS"]
    ---------------------------------------------------

    Thanks [/font]

  • Something like this would work

    declare @variable float

    set @variable = round(((555* 1.0) /1203) * 100 ,2)

    select @variable

  • SQL Learner-684602 (11/20/2009)


    Hi all

    I have a query to get % from two summed columns it gives me correct % but the zeros are not going off, even if I use round function.

    here is the code

    select round(((555* 1.00) /1203) * 100 ,2)

    any help to remove these zeros...

    thanks

    Do you want 2 decimal place zero's to show up if the answer is a whole number?

    --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 3 posts - 1 through 2 (of 2 total)

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