satyajit
satyajit

Reputation: 2700

clustered index on a column which has duplicate values

I have a table with no index. I need to add a clustered index on one column but the table does not have any column having unique data.Will this allow me to add clustered index on a duplicate column?

Upvotes: 0

Views: 6769

Answers (1)

yogi
yogi

Reputation: 19619

A clustered index does not enforce uniqueness unless you specify the keyword UNIQUE.

CREATE CLUSTERED INDEX bob ON foo( bar )

is not the same as

CREATE UNIQUE CLUSTERED INDEX bob on foo( bar )

You may be thinking of a PRIMARY KEY constraint in a CREATE TABLE statement. In this example:

CREATE TABLE foo ( bar PRIMARY KEY )

ASE will create a UNIQUE, CLUSTERED index on bar.

Upvotes: 5

Related Questions