Re: Changing serial value
Posted in 1997
Topics: SQL Development & Query Writing, Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL, Migration, Import/Export & Data Conversion
At 00:50 25/08/97 -0500, you 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. No there doesn't seem to be an easier way. A simple 4gl program that attempts to load the header from a temporary table containing the load with the original key and then inserting with key equal to 0 if failed in which case you would need to write details with new serial values (sqlca.sqlcode[2] I believe) using a foreach structure. You could do the latter straight-out and ignore the original serial if you like. But to answer your original question, no. Andrew Cilia - Philip Toledo Limited } } } } }marko kopac wrote: } }> I don't know how to change a serial value in a table (Informix }> database). I need this to copy a record to the same table. First I }> copy }> a record to a temp table. There I try to change the serial value and }> then to insert to the original table. This is my idea. Has anybody }> some }> another idea hove to solve this problem? }> }> Marko } } } }-- }- Danny Wright }danwright@bigfoot.com }#include <stddisclaimers.h> }* God is real, unless declared as an integer. }* Why do programmers get Halloween and Christmas mixed up? } Because 0CT(31) == DEC(25) }* I'd love to change the world, but I can't get into the source code. }* /nev/dull } } }