How Do I strip the decimal out of a price

  • Hi

    I'm not sure but just:

    SELECT CONVERT(INT, 21.80 * 100)

    ???

    Greets

    Flo

  • Thank you. I changed the line to convert only to an int and *100 like below.

    left(CONVERT(int,total_price*100)+' ', 6)

    the 21.80 converted to 2180. Thanks for your help.

  • Hey Flo! I have to ask... how did you get that picture of me first thing in the morning? 😛

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

  • Jeff Moden (3/5/2009)


    Hey Flo! I have to ask... how did you get that picture of me first thing in the morning? 😛

    Picture of you?? Maybe we are twins!!

    I'll gonna ask my mom...! 😀

  • florian.reischl (3/5/2009)


    Jeff Moden (3/5/2009)


    Hey Flo! I have to ask... how did you get that picture of me first thing in the morning? 😛

    Picture of you?? Maybe we are twins!!

    I'll gonna ask my mom...! 😀

    Heh... I'm gonna ask my Mom, too! If I see you there, we'll know, huh? 😀

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

  • tschuler (3/5/2009)


    Thank you. I changed the line to convert only to an int and *100 like below.

    left(CONVERT(int,total_price*100)+' ', 6)

    the 21.80 converted to 2180. Thanks for your help.

    How about this REPLACE(28.20,'.','')


    Kindest Regards,

    Amit Lohia

Viewing 6 posts - 1 through 7 (of 7 total)

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