Can we create a clustered index on composite primary key.
Answer Posted / anil kumar
Here's the procedure:
Create a table with no primary key defined.
Create clustered index on the primary key columns.
Alter the table to define the primary key.
Table creation:
create table CDSWEB.Anil (officeid integer not null,
empid integer not null,
age integer ,sex varchar(5),
name varchar(20));
Index creation:
create index CDSWEB.AN001 on CDSWEB.Anil(officeid,empid)
CLUSTER;
Primary key defined:
alter table CDSWEB.ANIL
add primary key (officeid,empid);
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What are the different index configurations a table can have?
What is outer join in sql server joins?
What is a virtual table in sql?
What is normalization? What number of normalization shapes are there?
Can you explain what is indexed view? How to create it?
Is sql server 2016 free?
What do you mean by an execution plan?
what is a deadlock? : Sql server database administration
How many partitions a clustered index has by default in sql server 2012?
Do you know what is similarity and difference between truncate and delete in sql?
Explain what role entity and relationship play in an ER diagram.
explain different types of constraints? : Sql server database administration
How to provide values to user defined function parameters?
What is the server name for sql management studio?
What is tcl in sql server?