Reputation: 3149
when i remove primary key constraint then SQL automatically remove the cluster index and
same for unique it will remove non-cluster index ?
Upvotes: 0
Views: 79
Reputation: 294227
A table can have at most one clustered index. The clustered index is the table. The clustered index is removed (the table is turned into a heap) when the clustered index is dropped. The primary key is not necessary the clustered index, but it usually is. The unique constraint/index in question may or may not remove a clustered index depending whether is was or it was not a clustered index.
Updated:
I think I misred the question. If you drop a unique constraint, it will remove the corresponding non-clustred index, yes.
Upvotes: 1
Reputation: 41266
Primary keys and other unique constraints are implemented using indexes which can be either clustered or non-clustered. If you remove the constraint you remove the index.
Upvotes: 1