of columns as a compound key to act as a PK (assuming they are unique)
_____
From: brobborb [mailto:[EMAIL PROTECTED]
Sent: 01 July 2004 14:29
To: CF-Talk
Subject: Re: Which to use as primary key?
You can only have 1 primary key. and usually it is the unique identifier.
however, those 4 columns can possibly be foreign keys. I am not sure what
your exact schema is, i am just generalizing.
----- Original Message -----
From: Peterson, Andrew S.
To: CF-Talk
Sent: Thursday, July 01, 2004 8:30 AM
Subject: OT: Which to use as primary key?
Hi,
I'm wondering from a performance perspective as well as a practical
perspective the best way to set up primary keys and indexes in a table
which will be used to drive a data entry/edit/retrieval-reporting
application.
I've got four columns that can be used as the primary key. I also have a
uniqueIdentifier field (I'm using SQL Server) that I generally use as a
primary key for my tables because it's so easy. It seems like it would
be four times as much work whenever I utilized the four fields that make
up the primary key rather than just using the uniqueIdentifier,
regardless of what scope I place them in (URL, Form, etc.) or how I use
them (where clause, procparams, etc.).
Instead of using the uniqueIdentifier as key, could/should I create the
primary key based on the aforementioned four columns? If so, would the
uniqueIdentifier field have any use, or should I just get rid of it? I
guess I could break my options down this way:
1. Use the four columns as the primary key and pass those through
the application for use in where clauses, etc
2. Use the four columns as the primary key and pass those through
the application for use in where clauses, etc. Also add a
uniqueIdentifier field and place an index on it (but don't use it?).
3. Use the four columns as the primary key. Add a uniqueIdentifier
field with an index on it and pass it through the application for use in
where clauses, etc
4. Forget about the four columns as a primary key. Make the
uniqueIdentifier field the primary key and pass it through the system.
Any ideas on the best route to take (and why) would be greatly
appreciated.
Sincerely,
Andrew
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

