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 use of @@ spid in sql server?
Explain rdbms?
What is an identity column in insert statements?
How to execute stored procedure and set temp table in sql server?
How do users use Report Builder with SQL Server data sources?
What is faster join or union?
What are the different types of stored procedures?
How to copy data from one table to another table?
Can you type more than one query in the query editor screen at the same time?
What are the difference between primary key and unique key? : sql server database administration
What are sql azure firewall rules?
If you want to send some data from access database to sql server database. What are different component of ssis will you use?
How to view the error log for any specific instance? : sql server database administration
What are the differences between “row_number()”, “rank()” and “dense_rank()”?
If a stored procedure is taking a table data type, how it looks?