|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How do I order a table in ascending order?
the code below works fine until the ActivityID goes above 9! the code below orders the data in the table in the following way 1,10,2,3,4,5,6,7,8,9 as you can see when I add 1 to the last entry in the list I get 10 again (9+1=10) the code then try’s to enter a duplicate key field into the table. How can I get the table to produce the following results 1,2,3,4,5,6,7,8,9,10......... Source code: sqlstr = "SELECT ActivityID FROM tblActivity ORDER BY ActivityID DESC" rs.open sqlstr, conn, 1,1 rs.movefirst dim lastid lastid = rs("activityid") rs.close rs("activityid") = lastid + 1 Many thanks in advance, Cheers Jon |
|
#2
|
||||
|
||||
|
If your fields are defined as integers, then it will sort as you expect. So set your field types as "int". If not, you need to convert the field using CONVERT or CAST.
|
|
#3
|
|||
|
|||
|
Thank you for your reply.
The change in the table properties you suggested has worked fine. Regards, Jon ![]() |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > table in ascending order? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|