How to remove Decimal point

  • Hi i have column with data type as Varchar.The coloumns contains the numbers with decimal point in between for ex: 789.24,7892.5 etc. How can i remove those decimal points. I want the result set as

    78924,78925.

    Thanks in advance.

  • dheer (2/22/2010)


    Hi i have column with data type as Varchar.The coloumns contains the numbers with decimal point in between for ex: 789.24,7892.5 etc. How can i remove those decimal points. I want the result set as

    78924,78925.

    Thanks in advance.

    you picked a great example; in your presentation, if you removed the decimal, how do you know that

    78925 is not one of these values: 7892.5 ,789.25 or 78925? don't you really need to round them up or down to the integer value, instead of stripping decimal? or multiply by 100 to get consistent values?

    anyway you could do it like this:

    SELECT REPLACE(CONVERT(varchar, 7892.5),'.','')

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Sorry for not mentioning properly....The number is a ..I m not rounding it off...i just want to remove that decimal....for ex if the number 789.90 .....after removing decimal it should be 78990 not 7899

  • Lowell !!!

    this SELECT REPLACE(CONVERT(varchar, 7892.5),'.','')

    has been very helpfull for me!!

     

    Thanks!!

    Teno.

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

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