ORDER by (numeric)

Results 1 to 4 of 4

Thread: ORDER by (numeric)

  1. #1
    kate Guest

    Default ORDER by (numeric)

    I have a query, sorted using ORDER by, on a numeric field. It&#039;s working, in a way, but the order the records come back in is ..... 1, 10, 10500, 11, 12, ... , 19, 20, 220, 23, ... 5, 500, 6, ...<BR><BR>ok, it has some sort of order, but seems to have completely forgotten the whole concept of place value.<BR><BR>Any ideas,<BR><BR>thanks,<BR><BR>Kate

  2. #2
    Eddie Campbell Guest

    Default RE: ORDER by (numeric)

    Are you absolutely sure that the data type is set to numeric in your database? That looks suspiciously like the correct sort order for a text field

  3. #3
    Kate Guest

    Default RE: ORDER by (numeric)

    you would not believe it - I had every field except &#039;Time&#039; set to numeric - and &#039;Time&#039; was a text field !!! Thankyou. <BR><BR>Now, I can&#039;t send some of the other fields via the query string, to my ORDER by thingy. For example, I can&#039;t use &#039;Credit Spread&#039; because of it being two words with a space. <BR>e.g. ... ?value=Time is Ok, <BR> but ...?value=&#039;Time&#039; or <BR> ...?value="Time" are both no good, <BR><BR>so I can&#039;t use ...?value=&#039;Credit Spread&#039; either<BR><BR>I either need better quote marks, or a nice escape character to represent the space in Credit Spread,..<BR><BR>This is going to continue to cause me grief isn&#039;t it ? It would be much better to avoid working with field names that have spaces (and icky characters like &) in them. The reason I have them at the moment, is that they are acting as column headings on the finished pages, so they need to be meaningful. So, as an alternative question, is it easy to have two different &#039;field names&#039; in the database - one for working with, one for displaying ?<BR><BR>Many Thanks,<BR><BR>Kate

  4. #4
    Eddie Campbell Guest

    Default RE: ORDER by (numeric)

    A couple of things.<BR><BR>1) To send stings with spaces and icky chars in them, use Server.UrlEncode to convert the string into an Html friendly version. So Response.Redirect "MyPage.Asp?value=" & Server.UrlEncode("Time is Ok") should work fine.<BR><BR>2) I understand why you want nice field names displayed on screen, but you should still get rid of the spaces as they are a real pain. Why not try this.<BR>Rename your field called &#039;Credit Spread&#039; to &#039;Credit_Spread&#039; and when you need to display it to the user, do a replace() on it.<BR><BR>FieldName = &#039;Credit_Spread&#039;<BR>So Response.Write Replace(FieldName,"_", " ") would display the two words with a space even though they have an underscore in the database.<BR><BR>Hope this helps.

Posting Permissions

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