OK. All accepted, and I dont want to embark on a religious conversion...
I accept there are 2 schools on this subject...and I belong to the surrogate
school.
To me it goes like this...
You have only 1 column involved in the PK
Its allways as fast or faster - never slower
Its a hell of a lot easier to write SQL when you only have to join on one
column. Coupled in with a good naming convention, SQL's are intuitive with
less need to refer to a data model. ie its easier and faster to code.
Th PK is just that - an element of uniquness and reference - it carries no
data value - thus we are left free to do whatever we want with the customer
data. He often has no idea what a PK is, and as a consequence doesnt give a
S... about our needs, and so arises the need for conjugate PK's. Now we are
on a down hill slide with our design.
Now if you belong to the surrogate club, then identities are of little use
as you nearly allways want the PK BEFORE you go about processing data not
AFTERWARDS.
NO...Generators and Identities are Not conceptually the same thing by any
stretch of the imagination, because quite simply a generator is available to
you at any time whereas Identities you can get only once - after the event.
How well will select identity@@ stands up to a realistic multi user DB being
hit hard with both in and out of transaction processing?? Does anybody know?
When you grab a generator it is yours exclusivly - guaranteed.
What happens with Identities when you export a table then import it back in?
Yes I know there are special switches in BCP to handle this, but its yet
another complexity isnt it.
I rarely use triggers to set generators. This brings them down to the level
of usefullness of a identity. Instead, they are iether selected back before
the processing starts, (in the case of a master table) or included as part
of the insert statement (typical for a detail record insert) It is very low
overhead to select back a generator in IB. Probably similar to selecting
back the Identity in MS.
So now maybe you can see why I am S..ed about the lack of generators in MS?
Cheers,
tony.
I cannot understand the recent diatribe over Intebase generators and MS SQL
Identity columns (they are basically the same thing)
Indentity columns are declared at the table level and have the same seed and
increment parameters. Generators are independantly declared and update the
target table in the trigger (pls correct me if im wrong). I think the
problems you may be having are more to do with the BDE than the identity
column. I don't use surrogate keys (to me they are an anachronism, simply
some sort of storage/index optimisation that is now redundant). I prefer
descriptive AlphaNumeric Primary Keys. As it make more sense for a customer
to be 'MWK001' than 132. And with trigger enforced RI (declaritive is to
restrictive) anything is possible
Hope this fires you all up
Neven
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz