Monday, March 12, 2012

Number conversion

Hi all!

I have a int-column that stores large numbers in my table and I want the output from a SELECT-statement to output it diffrent...

If the number is 6 100 000 The output should be 6.1 and 19 000 000 should be 19.1

I would also like the numbers to be rounded to the closest 100 000 (round(myInt, -5) right?)

thanks guys!Is this what your after

SELECT ROUND(Cast(Number as Decimal)/1E6,1)

Dave|||I'd suggest using:SELECT Cast(myColumn / 1e6 AS DECIMAL(6, 1))-PatP

No comments:

Post a Comment