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 it’s similarity with sql server?
What are the advantages dts has over bcp?
How to create indexed view?
List layers of abstraction microsoft architectured to provide relational db through cloud platform ?
What is user-defined function?
What are wait types?
Why I have to use stored procedures?
What are the advantages of sql azure?
What is difference between commit and rollback when used in transactions?
Explain the first normal form(1nf)?
Why I can not enter 0.001 second in date and time literals in ms sql server?
How many types of local tables are there in sql server?
is there a column to which a default can't be bound? : Sql server database administration
How to insert data with null values?
What is impersonation? What are the different impersonation options available in ssas? : sql server analysis services, ssas