Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello everyone,

Please consider the scenario....

I have a table called Invoice
with following columns
1. InvoiceID (int Primary Key)
2. InvoiceNo (nvarchar(20), unique)
3. InvoiceDate
4. CustomerID

By default "PK_Invoice" index is created as clustered index.
but i want to cluster using InvoiceDate, so i add an index called "IX_Invoice_Date"
and change the "Create as clustered" property to true. My Question is, will the index "PK_Invoice" still continue to be operational or will i need another index for "InvoiceID" feild?

Thank you
Posted

1 solution

Primary key can be based on a non-clustered index so if you build the table so that the clustered index is created for InvoiceDate, your primary key will still be operational. Clustered index for primary key is just the default 'setting'.
 
Share this answer
 
Comments
Abhinav S 5-Sep-11 8:01am    
Perfect.
Wendelius 5-Sep-11 8:02am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900