Can we create clustered index on non primary key column

Answer Posted / selvaraj.v

No, Because Constraints must have integrity. These are,
Clustered and Non-Clustered. So, to use Primary key with
any one Clustered or Non-Clustered index.

Example in SQL Server 2000:
Query :
-------
create table BookDetails
(
Book_ID int identity(1,1) not null clustered,
Book_Title varchar(20),
Book_Type varchar(15),
Book_Author varchar(25),
Book_Edition float,
Book_Publisher varchar(20),
Book_Pub_Year datetime,
Book_Price int
)

Answer:
-------
Server: Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'clustered'.

Prevent this Error To use Clustered Primary Key:
------------------------------------------------
Query In SQL Server 2000:
-------------------------

create table BookDetails
(
Book_ID int identity(1,1) not null primary key clustered,
Book_Title varchar(20),
Book_Type varchar(15),
Book_Author varchar(25),
Book_Edition float,
Book_Publisher varchar(20),
Book_Pub_Year datetime,
Book_Price int
)

Answer:
-------
The command(s) completed successfully.

Is This Answer Correct ?    4 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is bcnf normalization form?

860


How many columns can exist together per table?

904


can an order by clause be used in a creation of a view?

894


Give an example of why you would want to denormalize a database

726


What happens if ntwdblib.dll is missing on your machine?

890


how you can list all the tables in a database?

756


Do you know what are the differences between lost updates and uncommitted dependencies?

748


Explain about service Broker functions?

792


How to create a view using data from another view?

741


Create a dts package to produce a text file using the ‘update statistics’ command for the tables in a database with obsolete statistics.

720


Explain the properties of sub-query in sql server?

743


Why it is recommended to avoid referencing a floating point column in the where clause?

715


Define cross join in sql server joins?

761


how to create a scrollable cursor with the scroll option? : Sql server database administration

788


How column data types are determined in a view?

697