Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Can we create clustered index on non primary key column

Answer Posted / suraj

-- YES.

drop table Employees
create table Employees(
EmpID int Primary Key NonClustered,
[Name] varchar(20),
SSNo varchar(20) )

CREATE CLUSTERED INDEX ci_EMPLOYEES_SS ON EMPLOYEES (Name)

insert Employees values (101,'John','123-45-6789')
insert Employees values (102,'Mike','123-45-6789')


select * from Employees

-- We have to specifically define NonClustered in the
Primary Key column because Clustered Index is created by
default in Primary Key.
-- And, We are able to define Clustered Index in
another column because every table is eligible to have one
clustered index.
-- Clustered Index has to be created after table
creation.
-- From above example, EmpID doesn't take duplicates,
because it is primary key. But, SSNo takes duplicates.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I make a resultset scrollable?

924


Explain what are commit and rollback in sql?

877


query processing

2114


Explain full-text indexing?

928


Explain the difference between cross join and full outer join?

937


How to identify current user in ssrs report?

393


What is it unwise to create wide clustered index keys?

969


Tell me what is use of except clause? How it differs from not in clause?

915


Explain about nested stored procedure?

989


How can I change procedure name in sql server?

992


Explain about temporary stored procedure?

952


Define full outer join?

902


what is isolation level at dead lock?

2104


what is an extended stored procedure? : Sql server database administration

1009


What are the Advantages of using CTE in sql server?

1065