Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    31

    Unanswered: 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!

  2. #2
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    Is this what your after

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

    Dave

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'd suggest using:
    Code:
    SELECT Cast(myColumn / 1e6 AS DECIMAL(6, 1))
    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •