August 16, 2009 at 11:31 pm
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
August 17, 2009 at 8:49 pm
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
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply