long digit number to a decimal one

  • Hi All,

    I have numbers like 121212122, 12364232, 12367

    I just wanted these numbers as 121.2, 124.0, 124.0

    Can someone help me out with this......

  • Latheesh,

    The question, as posed, can't be answered. We need more information before we can assist.

    For example: is the precision of the desired output known? Can the precision of the input be predetermined?

    --SJT--

  • Thanks for your reply.Sorry if I took you to a dark as my question is not clear....

    There should be only 3 digits before the decimal point and 1 digit after decimal point.

    1234567 --> 123.5 (the digit after decimal is rounded)

    1235678 --> 124.0

    Is ther any system function to do the same.

    Can we work out with decimal conversion on the same.

    I dont wanna to be more complicated by dividing with 1000 or any multiplies of 100....

    Wnna make this task easier.

    Is there any way to do....or can I give more details on the same....

  • This kinda looks like homework.

    I'd recommend looking at the STUFF, CAST or CONVERT, and ROUND functions in the help files...

    --Todd

  • Based on the previous questions asked by Lateesh, I'm gonna say this isn't homework...

    SELECT STR(STUFF(1234567,4,0,'.') ,5,1)

    --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 4 (of 4 total)

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