Can we create clustered index on non primary key column
Answer Posted / vamsi krishna
Create table Testing(testingID int,testingdesc varchar(20))
Note: I am not defining TestingID as primaryKey
create clustered index IX_TestingID on Testing(TestingID)
-- This will allow u to insert duplicate values to the
column that has clustered index created.
Instead run the below command to create unique Clustered
Index
create unique clustered index IX_TestingID on Testing
(TestingID)
-- The above statment will not allow u to add duplicate
records.
For your better conformation insert some records into the
tabel and execute a select statement having the clustered
index column in the where clause and check the execution
plan. You can see Index Seek.
Conclusion : Clustered index can be created on non
primaryKey column
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are cursors and when they are useful?
What are exact numeric data types in ms sql server?
what are the critical issues you have resloved in your company
What is the fastest way to permanently delete a 1 million row table named customers?
What are trace flags and mention a few common trace flags used with sql server?
What is the current pricing model of SQL Azure?
What are triggers? How many triggers you can have on a table? How to invoke a trigger on demand?
What is primary key, unique key, and foreign key?
How do I find the sql server instance name?
If you want to send some data from access database to sql server database. What are different component of ssis will you use?
What are wait types?
What is fill factor and pad index?
Do you know what are the restrictions that views have to follow?
How to disable stored procedure sql server?
When would you use an insert into .. Select option versus an insert into .. Values option? Give an example of each?