sys.index_columns (Transact-SQL)

Contains one row per column that is part of a sys.indexes index or unordered table (heap).

Column name Data type Description

object_id

int

ID of the object the index is defined on.

index_id

int

ID of the index in which the column is defined.

index_column_id

int

ID of the index column. index_column_id is unique only within index_id.

column_id

int

ID of the column in object_id.

0 = Row Identifier (RID) in a nonclustered index.

column_id is unique only within object_id.

key_ordinal

tinyint

Ordinal (1-based) within set of key-columns.

0 = Not a key column, or is an XML index.

Columns of type xml are not comparable, so an XML index does not induce an ordering on the underlying column values. Since an XML index is, therefore not a key, the key_ordinal value will always be 0.

partition_ordinal

tinyint

Ordinal (1-based) within set of partitioning columns.

0 = Not a partitioning column.

is_descending_key

bit

1 = Index key column has a descending sort direction.

0 = Index key column has an ascending sort direction.

is_included_column

bit

1 = Column is a nonkey column added to the index by using the CREATE INDEX INCLUDE clause.

0 = Column is not an included column.

See Also

Reference

Object Catalog Views (Transact-SQL)
Catalog Views (Transact-SQL)
sys.indexes (Transact-SQL)
sys.objects (Transact-SQL)
CREATE INDEX (Transact-SQL)
sys.columns (Transact-SQL)

Other Resources

Querying the SQL Server System Catalog FAQ

Help and Information

Getting SQL Server 2005 Assistance