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
In which format does an image save in SQL Server database ?
How do I find information about the install locations for the various instances running on a computer?
Do you know what is user defined datatypes and when you should go for them?
What are the different authentication modes in sql server?
How to locate and take substrings with charindex() and substring() functions?
Tell me extended events in sql server 2008?
How to create a dml trigger using create trigger statements?
What is an example of a foreign key?
What happens if null values are involved in arithmetic operations?
What is the use of commit?
Explain candidate key, alternate key, and composite key?
What does it mean if @@cursor_row returns a negative number?
Explain how to integrate the ssrs reports in application?
What is the meaning of sql server?
Can we join two tables without primary key?