Subject Re: [firebird-support] Problem calling set generator...
Author Lester Caine
Alan McDonald wrote:
>> Hi, (This is Firebird 1.5.3)
>> I have an 'empty' database with a 'prefs' table which has a pk
>> 'prefs_sn', and a generator 'gen_prefs' which is initially set to 1.
>> I have a routine which copies all rows of the prefs table from one DB
>> into another (ALL columns, including the pk's).
>
> a better idea is to NOT include the PK field in the copy process. The PK
> will be re-generated - no need to fiddle any more

This may not be practical if the pk is being used in other tables, but
IS the right approach otherwise. I tend to CREATE the generator with the
right value after I've pumped the data, and not create any related
triggers until the pump process is complete. But I've not got as far as
putting it all into a script, PHP helps the process.

--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop -
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php