Can we create a clustered index on composite primary key.

Answer Posted / shatrunjay shukla

Yes
If you are creating a composite Primary Key, or a composite Clustered Index that is NOT a Primary Key, you are creating a single index that uses both column values as the clustering key.

CREATE TABLE T(id INT, cat INT, uName SYSNAME);

CREATE UNIQUE CLUSTERED INDEX ix_T_id_cat ON T (id,cat);



SELECT * FROM SYS.INDEXES WHERE object_id = OBJECT_ID('T');

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

hi i am working as a testengineer , so i want to no the backend data base connection can any one tell mwe in detail

1872


How to sort query output in descending order in ms sql server?

646


Can we insert data into a view?

698


Explain different forms of normalization?

604


How to change the password of a login name in ms sql server?

640






What are the benefits and tasks of object explorer? : sql server management studio

705


Why Master database is required?

676


How many cores do I need for sql server 2016?

593


What do you understand by replication in sql server? Mention the different types of replication in sql server.

599


How is table type constraint applied to a table?

640


How to get a list of columns using the "sp_help" stored procedure in ms sql server?

671


What are different types of database indexes?

613


What does nvl stand for?

630


How can we delete Duplicate row in table?

714


How many databases instances are there in sql server 2000?

656