473,397 Members | 1,950 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,397 software developers and data experts.

I need help in SQL table

2
i have a table named tblPerson. There is a field in it named PersonID. the data type of the PersonID is nvarchar(5).
there were 9999 rows in the table when i added the series of 10000-10010 it is not sorting the data as it should it. it is showing 10001 - 10010 after the rows of 1000 which is wrong why is it what should i do?

currently
1000
10001
10002
10003
1001

required
1000
1001
10001
10002
10003
Jul 11 '07 #1
6 1018
hariharanmca
1,977 1GB
i have a table named tblPerson. There is a field in it named PersonID. the data type of the PersonID is nvarchar(5).
there were 9999 rows in the table when i added the series of 10000-10010 it is not sorting the data as it should it. it is showing 10001 - 10010 after the rows of 1000 which is wrong why is it what should i do?

currently
1000
10001
10002
10003
1001

required
1000
1001
10001
10002
10003
if u sort the character it just by number of charecter serial

Expand|Select|Wrap|Line Numbers
  1. ex :
  2.  for 4 dig
  3. 1000
  4. 1000
  5. 1000
  6. 1000
  7. 1001
  8.  
  9.  
  10.  for 5th dig
  11. 1000
  12. 10001
  13. 10002
  14. 10003
  15. 1001

got the concept?
Jul 11 '07 #2
Kashan
2
if u sort the character it just by number of charecter serial

Expand|Select|Wrap|Line Numbers
  1. ex :
  2.  for 4 dig
  3. 1000
  4. 1000
  5. 1000
  6. 1000
  7. 1001
  8.  
  9.  
  10.  for 5th dig
  11. 1000
  12. 10001
  13. 10002
  14. 10003
  15. 1001

got the concept?
hi,
i did not understand what u wanted to say.
kindly clear by clearified example .
Thanks
Jul 11 '07 #3
hariharanmca
1,977 1GB
hi,
i did not understand what u wanted to say.
kindly clear by clearified example .
Thanks
1. You told the data type is varchar.
2. So, it will not sort the numbers lesser to greater
3. it will look for the order 0 – 9 like

Ex :

For 1 digit it’ll be correct
0
1
2
3
4
5
6
7
8
9

For 2 digit it’ll change like
0
1
10
11
12
13
14
15
16
17
18
19
2
20
21
.
.
.
Etc…,
Jul 11 '07 #4
hariharanmca
1,977 1GB
hi,
i did not understand what u wanted to say.
kindly clear by clearified example .
Thanks
did you got the concept
Jul 11 '07 #5
Vidhura
99
i have a table named tblPerson. There is a field in it named PersonID. the data type of the PersonID is nvarchar(5).
there were 9999 rows in the table when i added the series of 10000-10010 it is not sorting the data as it should it. it is showing 10001 - 10010 after the rows of 1000 which is wrong why is it what should i do?

currently
1000
10001
10002
10003
1001

required
1000
1001
10001
10002
10003
Change the PersonID to int type
Jul 11 '07 #6
hariharanmca
1,977 1GB
Change the PersonID to int type


Absolutely. You've to cahnge.........
Jul 11 '07 #7

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

Similar topics

0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
3
by: ChadDiesel | last post by:
Hello everyone. I need some advice on table structure for a new project I've been given. One of our customers sends us an Excel spreadsheet each week containing their order. Currently, someone...
10
by: Tom | last post by:
I am looking for some ideas for how to design the layout of the form for data entry and to display the data for the following situation: There are many sales associates. A sales associate can work...
11
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
21
by: Johan Tibell | last post by:
I would be grateful if someone had a minute or two to review my hash table implementation. It's not yet commented but hopefully it's short and idiomatic enough to be readable. Some of the code...
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
25
by: Jon Slaughter | last post by:
I have some code that loads up some php/html files and does a few things to them and ultimately returns an html file with some php code in it. I then pass that file onto the user by using echo. Of...
8
by: rshivaraman | last post by:
Hi : I have a TableA with around 10 columns with varchar and numeric datatypes It has 500 million records and its size is 999999999 KB. i believe it is kb i got this data after running...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.