Thursday, March 29, 2012

field is part of an index

Hello all,
What does it mean when a field is part of an index? Thank you.(rotaterx8@.yahoo.com) writes:
> Hello all,
> What does it mean when a field is part of an index? Thank you.

That it is part of an index:

CREATE TABLE somefields (a int NOT NULL,
b int NOT NULL,
c datetime NULL,
d varchar(23) NOT NULL,
CONSTRAINT pk PRIMARY KEY (a,b))
go
CREATE INDEX d_ix ON somefields(d)

Here, all columns but c are parts of an index. a and b are part of
an index, because a primary key is implemented as an index in SQL Server.

I guess there is some reason why you ask. If you are trying to change the
collation of an indexed column, you must drop the index first, change
the collation, and then recreate the index.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspxsql

No comments:

Post a Comment