Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2011
    Posts
    24

    Unanswered: How to convert number to 2 decimal?

    Hi,

    i have 001747254 and 000096710 in column 'price'
    i want it to display as 17472.54 and 967.10
    how can i do this in one query?
    thanks in advance

  2. #2
    Join Date
    Apr 2012
    Posts
    213
    Hi,

    Try something like that:

    Code:
    select (Price / 100) as Price from MyTable
    or

    Code:
    select (CAST(Price as money) / 100) as Price from MyTable
    Hope this helps.

  3. #3
    Join Date
    Nov 2011
    Posts
    24
    Quote Originally Posted by imex View Post
    Hi,

    Try something like that:

    Code:
    select (Price / 100) as Price from MyTable
    or

    Code:
    select (CAST(Price as money) / 100) as Price from MyTable
    Hope this helps.
    THANKS IMEX, but when i use the first code, i loose last 2 digits after

  4. #4
    Join Date
    Apr 2012
    Posts
    213
    You can also try:

    Code:
    select (Price / 100.0) as Price from MyTable
    Hope this helps.

  5. #5
    Join Date
    Nov 2011
    Posts
    24

    Solved

    Quote Originally Posted by imex View Post
    You can also try:

    Code:
    select (Price / 100.0) as Price from MyTable
    Hope this helps.
    Thanks buddy, works great

Posting Permissions

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