Re:AutoIncrement and Ref Integrity
Quote
Jouko Tolonen (roo00...@ceg.co.za) wrote:
: "Criston Musgrave" <cris...@midwest.net> wrote:
: - Use separate table where you store one value - the highest used to
: date. When you add record separate table is read incremented by one
: and used as a key.
This is, AFAIK, the only reasonably portable solution, since it doesn't
require anything but standard SQL. You should, however, make use of exclusive
locking and transaction management to ensure that only a single operation
is permitted against the sequence table at one time, or duplicate pkeys
will be created in multiuser situations.
: The clever people say that it is better not to use numeric key because
: you can easily calculate with it in error. To use alfanumeric field
Why would you want to do calculations on a primary key? Are you using
surrogate keys or are you coding values into your pkeys?
--
Ebbe Jonsson, Systems Mangler e...@dbm.fi
Key Systems Oy, Helsinki, Finland
Tel: +358 0 605 900, Fax: +358 0 605 991 " Why me? "