Re: Changing serial value
Posted in 1997
Daniel Wright wrote: > > I don't really have any new ideas to add to the solutions, but wondered > if anyone else had encountered the following problem and had a solution > to it. > > A header table uses a serial column for it's key. The detail table uses > this key to join it to the header. Now what do you do if you must > unload some rows from the 2 tables and insert them into a new database? > In many cases, you will NOT be able to re-use the same serial keys for > the header table as they are potentially already in use by the database > you wish to load them into. > > I suppose we could write a program to do this, but I was wondering if > there were any easier way. That's it, a custom application is the best solution. For a one shot deal you could just unload the rows ordered by key, determine the largest key on the other server/database, use awk/perl/C to modify the unload files with appropriate numbers larger than that by adding a fixed value to each key, then load header rows followed by detail rows. Art S. Kagel