How To:Copyrows and assign new keys in mass HELP (AREV Specific)
At 24 JAN 2001 08:10:38PM John Wood wrote:
I am trying to integrate records from two similiar tables. The two tables' dictionaries are identical. So, I would like all data copied from the source table rows to the destination table but need new sequential numbered keys assigned to avoid overwriting like keyed rows in the destination table. I am copying 400-500 records at a time so manually specifying target keys is not an option. I have that feeling there's an incredibly obvious solution and would be very greatful to anyone who would offer it up. email:[email protected]
At 24 JAN 2001 11:55PM Jonathan Bird wrote:
Seems like a small RBasic programme would be in order.
how about this (not tested, of course!) and would do better with a few messages to the status line to let you know what is happening, too.
COUNTER=0
DONE =0
OPEN 'SOURCETABLE1' TO INFILE1 THEN
OPEN 'SOURCETABLE2 TO INFILE2 THENOPEN 'DESTINATIONTABLE' TO OUTFILE THENSELECT INFILE1LOOPREADNEXT ID ELSEDONE=1ENDREADO REC FROM INFILE1,ID THENCOUNTER += 1WRITE REC ON OUTFILE,COUNTER ELSEFSMSG()ENDENDUNTIL DONEREPEATdone=0SELECT INFILE2LOOPREADNEXT ID ELSEDONE=1ENDREADO REC FROM INFILE2,ID THENCOUNTER += 1WRITE REC ON OUTFILE,COUNTER ELSEFSMSG()ENDENDUNTIL DONEREPEATENDENDEND
At 24 JAN 2001 11:56PM Jonathan Bird wrote:
Uuurgh! what happened to my INDENTATIONS after posting???
At 25 JAN 2001 09:01AM Don Miller - C3 Inc. wrote:
You can mostly do what Johnathan said. It's probably wise to get the current value of %SK% from the "Master" table and increment that value by 1. At end of job, update %SK% with the final value. You might also test to make sure that you're not overwriting an existing record. If you get a hit on the read, bump the counter by 1 and keep trying until you don't get a hit.
Don Miller
C3 Inc.
At 25 JAN 2001 09:51AM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
or if you'd prefer not to cut code
, export them to an ascii file then reimport them having the system assign the key!
World Leaders in all things RevSoft
At 25 JAN 2001 04:12PM Don Miller - C3 Inc. wrote:
Indentations vanish .. like other things on the web. There's a great bit-bucket in the sky .. reminds me of write only memory.
Cheers…
Don Miller