Subject Re: Multiple generators
Author Adam
--- In, "killerion" <jankowiak@...>
> In my DB, I need to keep track of different the offices of a company,
> and they want to be able to create or eliminate the offices, but
> depending on type, location, etc... they have different types of
> identifiers, now I want to know if I can use multiple generators for
> one table or do I need to manage them in different tables... if it is
> possible to do this how?

You may have learnt about candidate keys. Great. Never use them as
primary keys. By all means define whatever unique constraint you need
to for your business rules, but always create a surrogate field for
your primary key.

Of course a work around by incrementing particular generators by an
agreed amount greater than the number of offices is possible (although
it does limit the number of offices you can possibly create), although
it makes replication much easier when your PKs can simply be copied
without transformations, I don't like the idea.