473,386 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to order a set of number

hai...

i'm doing a simple program where it will sort a set of number from 1 to 100. for 1 to 9 it sort correctly. but after number 9 (10,11,...), the sort become 1,10,11, 12...,2,20,21,..and so on. Can somebody tell me how to sort it correctly?

thank you..
May 22 '06 #1
2 1389
Banfa
9,065 Expert Mod 8TB
looks like you are doing a text sort rather than a binary sort. In a text sort each character of the number is considered in turn so for the numbers 10 and 2 the first characters are 1 and 2 and 1 < 2 therefore 10 < 2. A binary sort will compare the actual value of the number that is compare 10 with 2 therefore 2 < 10.

You have not mentioned what system you are using but you need to make sure that you are doing a binary comparison, possibly by converting the text to binary data first.
May 22 '06 #2
dear banfa,

you are correct..
after convert the text to binary, it is work...
thank you very much
Jun 1 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ryan Wagner | last post by:
I am doing many SQL insert statements to insert records into an oracle database. I need the order of the records, after inserting all records, to be the same as the order I inserted them in. Right...
15
by: | last post by:
The data file is a simple Unicode file with lines of text. BCP apparently doesn't guarantee this ordering, and neither does the import tool. I want to be able to load the data either sequentially...
3
by: Charles | last post by:
I am trying to add the ability for a user to change the order in which the elements are listed in a dropdown list box. Before I added the ListID field the dropdown list box order was controlled...
1
by: Gregg | last post by:
I created an append query that pushed 100's of orders form one table into another. I'd like to assign a new order number to each order as I append them to the new table based upon the maximum...
13
by: bevanward | last post by:
Hi All I am finding unexpected results when inserted into a newly created table that has a field of datatype int identity (1,1). Basically the order I sort on when inserting into the table is...
4
by: Frederick Gotham | last post by:
What do you think of the following code for setting and retrieving the value of bytes in an unsigned integer? The least significant bit has index 0, then the next least significant bit has index 1,...
2
by: Sin Jeong-hun | last post by:
com.CommandText="SELECT title FROM books ORDER BY title"; com.ExecuteReader(); ...... The titles contain Alphabets, Hangeul(the Korean alphabets) and numbers. The ORDER BY sorts titles in...
0
by: tedlaraghu | last post by:
Hi everyone, When I am using dynamic sql with USING clause ,the results are not sorted in Ascending order. DECLARE TYPE emp_refcursor IS REF CURSOR; emp_rc ...
12
by: badvoc | last post by:
Hi, I have had some good fortune on this site so I am back and I must iterate I am a beginer. I am having some problems getting to grips with the right technique to manage variables and...
25
by: DanicaDear | last post by:
Hello again Bytes...I missed you! First, background: In a hotstick lab, we ship orders every two years. We ship a new order and the customer uses the new box to return the previous year's order....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.