Format change
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Format change

  1. #1
    Join Date
    Apr 2001
    Posts
    12
    Is there any function in SQL Server to change the format of a numeric field(e.g. value 125000 to $1,25,000, 10000 to $10,000 etc ),just like TO_CHAR function in Oracle

  2. #2
    Join Date
    Nov 2000
    Location
    Israel
    Posts
    268
    Hi,
    you can try to use the CAST(expression AS data_type) or CONVERT (data_type[(length)], expression [, style])
    functions.

    ex:
    select CAST(EMPNO AS char(2)) from EMP;
    select CONVERT(char(2), EMPNO) from EMP;

    regards.

  3. #3
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    It's been a long time since SQLServer, but for some reason, I think that the conversion functions will only convert the datatype. I *think* you then want to use a function maybe called 'format' to actually format the string - not positive of this at all - just something to check into.

    - Chris

  4. #4
    Join Date
    Apr 2001
    Posts
    12
    the problem is still unsolved

  5. #5
    Join Date
    Aug 2000
    Posts
    462

Posting Permissions

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


Click Here to Expand Forum to Full Width