Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is similarity and difference between truncate and delete in sql?

1150


Why does sql studio use a single registered database repository? : sql server management studio

1034


What is the cartesian product of table?

1057


How many types of cursor type are there?

1162


What is index fragmentation in ms sql server?

1138


What are different types of statement?

1081


Differentiate between a primary key and a unique key.

1111


Can sub report data source be different from that of the parent report?

149


Does dbcc checkdb requires db to be in single_user mode? : sql server database administration

1025


What are binary string data types in ms sql server?

1378


What is the command to change the recovery model?

1091


explain extended properties

1034


How to list all schemas in a database?

1100


How to download and install microsoft sql server management studio express?

1083


What command would you use to add a column to a table in sql server?

1354