Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 downside of multiple primary keys

Author  Topic 

heze
Posting Yak Master

192 Posts

Posted - 2006-10-11 : 00:02:29
Hi, from the "best practice" perspective, how convenient is to use multiple field primary keys in a table, how convenient is it to replace a multifield pk with an autoincrement field to represent such a table?
I tried using a calculated field product of appending the fields that cvompose the primary key, but MySQL for example, does not provide with that functionality, which makes me wonder it doing so in SQL Server is a good practice at all.


Thank you

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-10-11 : 00:07:10
As regard to multiple-field primary key (composite key), it makes index bulky if too many columns added to it. Further more, if you want index seek, you should maintain same order of fields in your WHERE condition as it is in the primary key.


With regards to pros and cons of Identity column as key, check out the following discussions:

[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=27248[/url]
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=24776[/url]

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -