question

shamim007 avatar image
shamim007 asked

clustered index without primary key

hi all ,

i need help to create a clustered index but i dont have PK in my table .what is the best way to add a clustered index on my table without PK .

clustered-index-without-pk.txt

thanks

sql-server-2008clustered-index
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Kev Riley avatar image
Kev Riley answered

First of all, let's gets some facts straight - a primary key does not need to be a clustered index, and a clustered index does not need to be a primary key.

So.... creating a clustered index without a primary key, is as simple as

create clustered index CIX_CredentialHistory on CredentialHistory(ID)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.