Subject Re: [firebird-support] merge tables
Author Ann W. Harrison
Ivan Setya Darmawan wrote:
>
> I need to merge northpole customer
> table and southpole customer table to a single customer table in
> headquater database.
>
> I think, using autoincrement for cust_id is not a choice...

Sure it is! Make your primary key compound: one part created
with a generator, the second part being either N (for North Pole
customers) or S (for south pole customers.).

> BEGIN
> /* Trigger body */
> IF (NEW.CUST_ID IS NULL) THEN
> NEW.CUST_ID = RAND();
> END
>
> Do I on right track here or anyone has many better ideas?

Using a random number generator for primary keys is not a good
idea. Especially given the really really abysmal implementation
of RAND in our UDF library.

Regards,


Ann