Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Key or no Key

Status
Not open for further replies.

OldSlowDog

Programmer
Mar 11, 2002
36
US
Hollo all,
Just curious, I am collecting sales data from 20 remote locations into a table (AllSales), and then I pivot the table into summaries and totals for reporting.

I have been struggling with the dilemma of should I define the AllSales table with key or without key. From user retrieval standpoint, the table will not be used for that purpose. How about from the processing perspective? I don’t know.
 
Every table should have a way of uniquely identifying a row of data. If that is a unique constraint, a primary key, or an Identity column, then that's what it takes.

When, 6 months down the line you have to update 1 row of data you will be kicking yourself for having 6/10 parameters in your where clause, instead of the one unique column.

Give it something, anything, for a key.

David

-Sometimes the answer to your question is the hack that works
 
I agree. I have never regretted creating a primary key but if you don't then the day comes when you wish you had.

"NOTHING is more important in a database than integrity." ESquared
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top