Thread: Renumber ID
11-16-06, 09:32 #1Registered User
- Join Date
- Sep 2006
Unanswered: Renumber ID
Looking to run a script that will duplicate a Paradox DB. I have a "test" db that has 1382 records in it. I want to duplicate this to around 30k to run some tests on. We are rewriting our software from Paradox (before my time), and thus I need some help.
The ID Field is N, but am not sure of the proper command to do this. I need to update this field so that when it duplicates the DB it makes the record that is presently #1 and makes it #1383, and so on. So, if anyone could be of assistance on this I would be much appreciative.
Thanks in advance.
01-28-07, 07:46 #2Registered User
- Join Date
- Aug 2003
- Bologna - Italy
You should write a script which opens a tcursor on the table, then reads in the number of records, and then repeats this number of times the insertion of another record using another tcursor on the same table.
You sholud then, just before saving each new record, generate another ID for the new record , for example by using CMAX function on the second tcursor;
Otherwise, you can duplicate the table with a different name, and alter it to make the ID field autoincrement, and then the procedure i described can be done without setting the new record ID, since it will be autogenerated by pdox.The only failure is not trying to do it.