Results 1 to 2 of 2

Thread: Renumber ID

  1. #1
    Join Date
    Sep 2006
    Posts
    11

    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.

  2. #2
    Join Date
    Aug 2003
    Location
    Bologna - Italy
    Posts
    209
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •