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 is a primary index?
Differentiate between a local and a global temporary table?
Which operator do you use to return all of the rows from one query except rows are returned in a second query?
Why do we use non clustered index?
Why use stored procedures in sql server?
I have a table Events Events containing cardno,time,id,name--each id has a cardno my requirement is every day each employee swipe the card several times i want to calculate first and last time of each card the output should be name 1 2 6 7 in out in out holiday holiday xxx 09:30 06:30 09:40 06:45 where 1,2...... are dates for example january 1,2, etc. 6 and 7 are saturday and sunday how it is posssible
Explain what is lock escalation and what is its purpose?
Explain raiserror in sql server?
Please explain what is “asynchronous” communication in sql server service broker?
What is repeatable read?
What is auditing in sql server?
Explain trigger classes i.e. Instead of and after trigger?
Can sql servers linked to other servers like oracle?
Explain datetime2 data type in sal server 2008?
How can you append an identity column to a temporary table?