Can we create Primary Key on more than one column? [Resolved]

Posted by Neerajprasadsharma under Sql Server on 5/22/2017 | Points: 10 | Views : 404 | Status : [Member] | Replies : 1
Can we create Primary Key on more than one column?

Contact for Free SQL Server Performance Consulting and Training for you or your Organization.


Responses

Posted by: Neerajprasadsharma on: 5/22/2017 [Member] Bronze | Points: 25

Up
1
Down

Resolved
This question is pretty straightforward, so the answer is YES offcourse. When we create a Primary Key in more than one column it is called Composite Key. SQL Server allows maximum 16 columns combination as primary key.
Yes, SQL Server allows Composite Key on maximum 16 columns,
But that doesn`t mean you should. We have recently written about this so please visit this link consider it as a part of the answer.
http://www.dotnetfunda.com/forums/show/22484/is-it-necessary-to-have-a-primary-key-on-the-table





Other Related Question in series:
Can We Create Primary Key with Clustered Index in SQL Server?
How to create a Primary Key without Clustered index?
Why SQL Server by default creates clustered index on the Primary Key?
Can we create a Primary Key without clustered index?
Can we create Primary Key without any index?
Can we create Primary Key on more than one column?
Can we have a functinality of Primary Key without creating a Primary Key?
Why Primary Key doesn`t accepts null values?
What is the need of Primary Key?
Is it mandotary to have a Primary Key in the table?

We will try to answer all the above questions and link all of them to each other,
We welcome everybody to contribute to this question answer series.

Contact for Free SQL Server Performance Consulting and Training for you or your Organization.

Neerajprasadsharma, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response