Re: Changing serial value
Posted in 1997
Daniel Wright <dw420@airmail.net> 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.
Then we do:
unload to "unloadfilename"select serialcolumn + 10000, othercolumns....
from tablename
The 10000 you obviously set to whatever fits your data.
You can obviously do a similar thing if you do a direct insert in that
other table (no unload/load).
Nils.Myklebust@idg.no
NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway
My opinions are those of my company
The Informix FAQ is at http://www.iiug.org