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
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Why is it some tables have 2 primary keys ?

Author  Topic 

mary_itohan
Posting Yak Master

191 Posts

Posted - 2008-09-14 : 08:40:41
hi all,
Why is it some tables have 2 primary keys ?
thanks

_____________________


Yes O !

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-09-14 : 08:47:08
Tables can't have two primary keys. What you may be seeing is tables that have a primary key comprised of two columns, meaning that the two together are unique.

Where are you looking at the tables?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-14 : 09:26:51
its just a composite key which comprises of more than one column. A composite primary key is used in cases where you need values from more than one column to uniquely identify a row of your table.Defining a primary key on them will ensure the unique combination of values is maintained.
Go to Top of Page

lepeniotis
Yak Posting Veteran

75 Posts

Posted - 2008-09-17 : 06:20:00
Hi mate read this blog I think that it may help you! Explains exactly the use of the composite keys!

http://weblogs.sqlteam.com/jeffs/archive/2007/08/23/composite_primary_keys.aspx

Regards


MSc Advanced Computing Science
MSc Database Professional
Sheffield Hallam University
MCP (70-229, 70-228)
Industrial IT Engineer
Go to Top of Page

sailaja pasupuleti
Starting Member

1 Post

Posted - 2008-09-17 : 11:15:55
Hi,

It is a composite key i.e., primary key applying on two (or more than two) columns.

Regards,
Sailaja
Go to Top of Page
   

- Advertisement -