473,657 Members | 2,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to order a set of number

31 New Member
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 1400
Banfa
9,065 Recognized Expert Moderator Expert
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
sakurasyi
31 New Member
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
4989
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 now my program fails to keep the records in order if the number of records is large. I inserted 100,000 records and the first record after all inserts were done was record#540. I have been told that the /*+ APPEND */ hint and /*+ PARALLEL */ hint...
15
4307
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 or add line numbering to large Unicode file (1 million lines). I don't want to deal with another programming language if possible and I wonder if there's a trick in SQL Server to get this accomplished. Thanks for any help. Mark Leary
3
7083
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 using the MotorhomeID. The problem I am having is that I don't know the best method for allowing people to make the ListID changes easily. Database: MS Access 2000 Table: Default-Motorhome Fields:
1
3939
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 order number already found in the "append to" table + 1. Any help is appreciated. Gregg Horwitz
13
4437
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 not reflected in the order of the values from the identity field. Have I been wrong in assuming that it should reflect the order from the sort?
4
2210
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, and so on. The code computes at runtime the byte-order of the unsigned integer, but alas it would be better if it could be determined at compile-time. The code potentially invokes undefined behaviour if an unsigned integer contains padding bits....
2
2555
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 number-Hangeul-Alphabets order. (Maybe this is because the system locale is Korean. I have ascertained that when the Regional Options' Standard and formats are set to Korean, the items in Windows Explorer are sorted in number-Hangeul-Alphabets order...
0
2682
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 emp_refcursor; TYPE v_emp_id IS TABLE OF number INDEX BY PLS_INTEGER; TYPE v_last_name IS TABLE OF varchar2(50) INDEX BY binary_integer; V_empno v_emp_id; v_ename v_last_name;
12
28427
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 adding a unique order number to a customer order form. I have 4 stages to my order form. Stage 1 involves the user selecting a link based on what they want. The link then sets 2 variables. $type and $fault based on the link they have chosen.
25
2831
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. For example, in November 2007 we shipped an order. November 2009 those sticks expire, and we ship a new order (because customers can't be without sticks) and when they receive the new 2009 order they ship back the old 2007 order. A box number...
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8723
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.