Display Numeric Data in Scientific Notation

  • I am trying to write a query which display or fetch Numeric Data in Scientific notation with mentions (No. of) Decimal places.

    Can anyone Explain me how can i get a Numeric Data (All Types) in Scientific Notation.

    More Over i want get comparison with data..

    e.g.

    Select* from table1 where col1(Num) = -1.06E+3.

    Now here suppose Col1 has values -1056 , and i have value in Scientific notation with two decimal places as(1.06E+3)..

    Can you please tell me how can i get copared ...

    Note: there is one restriction that i cannot change the datatype for col1.

    regards

  • Just a hint...

    SELECT -1.06E+3, ROUND(-1056,-ROUND(LOG(ABS(1.06E+3))/LOG(10),0,1)+2)

    Of course, if you use that in a WHERE clause, there's no way an Index Seek will ever occur. The formula is deterministic so it would be better to add a computed column to the table with the conversion formula in it and index 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)

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

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