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 is similarity and difference between truncate and delete in sql?
Why does sql studio use a single registered database repository? : sql server management studio
What is the cartesian product of table?
How many types of cursor type are there?
What is index fragmentation in ms sql server?
What are different types of statement?
Differentiate between a primary key and a unique key.
Can sub report data source be different from that of the parent report?
Does dbcc checkdb requires db to be in single_user mode? : sql server database administration
What are binary string data types in ms sql server?
What is the command to change the recovery model?
explain extended properties
How to list all schemas in a database?
How to download and install microsoft sql server management studio express?
What command would you use to add a column to a table in sql server?