Problem in inserting data from Vb.net form in Sql Server 2000

shakir

Member
Joined
Dec 22, 2006
Messages
6
Programming Experience
Beginner
When i insert Data from Vb.net form to sql server 2000 ...my datatype is varchar ...coloum name is id ,and formate of my id is 1-ff-2007 , while 1 is increment every time..but the problem is that when id reach to 10 it is inserted in between 1 and 2 ...It is not in sequence or ascending order...
eg
1-ff-2007
10-ff-2007
11-ff-2007
2-ff-2007
3-ff-2007
4-ff-2007
5-ff-2007
6-ff-2007
7-ff-2007
8-ff-2007
9-ff-2007
any one tell me how can i mantain it....
 
Because the type is varchar, it's doing an ASCII sort.... 1 comes before 2, it's as simple as that.... to "fix" it, you should have leading 0's in front of the shorter ones... 001-ff-2007, like that.

-tg
 
Back
Top