Can we create primary key without any index? [Resolved]

Posted by Neerajprasadsharma under Sql Server on 5/17/2017 | Points: 10 | Views : 538 | Status : [Member] | Replies : 3
Is it possible to create primary key without any index?

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


Responses

Posted by: Neerajprasadsharma on: 5/17/2017 [Member] Bronze | Points: 50

Up
1
Down

Resolved

If this question comes just out of curiosity, then we will say NO it is not possible, but if you don`t want a clustered index on it, then yes, we can create a Primary Key with Non Clustered Index. See the below link
http://www.dotnetfunda.com/forums/show/22466/how-to-create-a-primary-key-without-clustered-index

Keys are used in the queries (Where, Join, Group By, Order By etc), and index on the keys make them more faster than non key columns, so its a better choice to have an Index on keys, As far as I am aware all popular relational databases uses indexes on the Keys.
Probably in the old version of SQL Server we can do that, but not on the SQL Server 2000 and above version.
There would a very rare example where a user genuinely wants only constraint without any index.




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 mandatory 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

Posted by: Mary11 on: 5/18/2017 [Member] Starter | Points: 25

Up
0
Down
Thanks a lot for your post. It helped me too.

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

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

Up
0
Down
Your Welcome, keep following the series. Plenty to come :)

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