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
How to define the name and server for a new dsn?
do views contain data ?
What is equi join with example?
Explain the microsoft sql server delete command? : SQL Server Architecture
Difference between aggregate functions of sql?
What stored by the tempdb ? : sql server database administration
How to create nested stored procedure?
What command is used to delete a table from the database in the sql server and how?
Write an SQL query to obtain the 2nd highest salary.
What is the difference between coalesce() & isnull()?
How will you monitor replication latency in transactional replication? : sql server replication
What are the different types of replication you can set up in sql server?
What is postgresql server?
Do you know what is blocking?
After creating the cube, if we added a new column to the oltp table then how you add this new attribute to the cube? : sql server analysis services, ssas