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
What is bcnf normalization form?
How many columns can exist together per table?
can an order by clause be used in a creation of a view?
Give an example of why you would want to denormalize a database
What happens if ntwdblib.dll is missing on your machine?
how you can list all the tables in a database?
Do you know what are the differences between lost updates and uncommitted dependencies?
Explain about service Broker functions?
How to create a view using data from another view?
Create a dts package to produce a text file using the ‘update statistics’ command for the tables in a database with obsolete statistics.
Explain the properties of sub-query in sql server?
Why it is recommended to avoid referencing a floating point column in the where clause?
Define cross join in sql server joins?
how to create a scrollable cursor with the scroll option? : Sql server database administration
How column data types are determined in a view?