I've got a problem I hope someone can help with.
I'm writing an application in Visual Basic to manipulate a dbase III table. I'm trying to copy several records and insert them back into the table. The table has no indexes and for circumstances beyond my control, I can't add any either.
There is a field in the table ("SORT" that determines the order the records should be in. This column contains numeric data but it is a text field (once again, I can't change it) so if I try to actually sort on the field in my
SQL statement, everything gets all jumbled (So I can't do it in a single step using a union query)
I've actually figured out one way that works. Step one is to insert the records using a single SQL statement:
The second step is to create a new table by copying all the records in the correct order like this:
This works. Unfortunately, though, the bigger the table, the longer it takes. A table with a quarter million records took over twenty minutes and there could potentially be even more records.
Does anyone have any ideas on how I could accomplish this task in a shorter period of time?
-Coco
I'm writing an application in Visual Basic to manipulate a dbase III table. I'm trying to copy several records and insert them back into the table. The table has no indexes and for circumstances beyond my control, I can't add any either.
There is a field in the table ("SORT" that determines the order the records should be in. This column contains numeric data but it is a text field (once again, I can't change it) so if I try to actually sort on the field in my
SQL statement, everything gets all jumbled (So I can't do it in a single step using a union query)
I've actually figured out one way that works. Step one is to insert the records using a single SQL statement:
Code:
MyDb.Execute "insert into OLDTABLE select * from OLDTABLE
where SORT in ('" & LIST_OF_RANDOM_NUMBERS& "')"
Code:
MyDb.Execute ("SELECT * into NEWTABLE FROM OLDTABLE
ORDER BY Val([SORT])")
Does anyone have any ideas on how I could accomplish this task in a shorter period of time?
-Coco