Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    30

    Unanswered: Basic formatting questions

    I have two questions concerning formatting output in SQL.

    I have a processer speed column that I would like to make usable. A sample entry is 2793, which I would like to be returned as '2.8 GHz'. I am using the following successfully, but when I try to append the ' GHz' it gives me a conversion error (I have tried putting both a cast and convert around the round statement).
    ROUND(CONVERT(DECIMAL,PCCPUSpeed_IN) / 1000,1) + ' GHz'

    Secondly, I have a RAM colum that stores values such as 534753280. I would like the results to fallin into 64 Mb buckets. So values between 512000 & 532480 should return '512 Mb'. I realize I can do this using a CASE statement, but is there a better way?

    Thanks,

    Rob

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    All formatting really ought to be done on the client or at least in the middle tier. Doing formatting in the database is suicidal from both a performance and a scaling perspective in the long term.

    -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
  •