.. _sql_server_index_columns(SQLServer):

sys.index_columns
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

每列包含一行，该列是索引表或无序表 (堆) 的一部分。

.. table:: sys.index_columns 列
      :widths: 4 2 4
      :class: longtable
   
      +----------------------------+----------+--------------------------------------------------------------------------------------+
      | 名称                       | 数据类型 | 描述                                                                                 |
      +============================+==========+======================================================================================+
      | object_id                  | oid      | 定义索引的 对象的 Oid                                                                |
      +----------------------------+----------+--------------------------------------------------------------------------------------+
      | index_id                   | int      | 定义了列的索引的 ID                                                                  |
      +----------------------------+----------+--------------------------------------------------------------------------------------+
      | index_column_id            | int      | 索引列的 ID                                                                          |
      +----------------------------+----------+--------------------------------------------------------------------------------------+
      | column_id                  | int      | 索引键列在表中的列号                                                                 |
      +----------------------------+----------+--------------------------------------------------------------------------------------+
      | key_ordinal                | tinyint  | 键列集内的序数（从 1 开始）                                                          |
      +----------------------------+----------+--------------------------------------------------------------------------------------+
      | partition_ordinal          | tinyint  | 分区列集内的序数（从1开始）                                                          |
      |                            |          |                                                                                      |
      |                            |          | 0=非分区列                                                                           |
      +----------------------------+----------+--------------------------------------------------------------------------------------+
      | is_descending_key          | bit      | 索引键列排序顺序是否为降序                                                           |
      |                            |          |                                                                                      |
      |                            |          | 1=索引键列具有降序排序方向                                                           |
      |                            |          |                                                                                      |
      |                            |          | 0= 索引键列具有升序排序方向，或列是列存储或哈希索引的一部分                          |
      +----------------------------+----------+--------------------------------------------------------------------------------------+
      | is_included_column         | bit      | 键列是否为非索引键                                                                   |
      |                            |          |                                                                                      |
      |                            |          | 1=列是使用 CREATE INDEX INCLUDE 子句添加到索引中的非键列，或者列是列存储索引的一部分 |
      |                            |          |                                                                                      |
      |                            |          | 0=列不是包含的列                                                                     |
      +----------------------------+----------+--------------------------------------------------------------------------------------+
      | column_store_order_ordinal | tinyint  | 目前暂不支持该字段，当前字段默认值为0                                                |
      +----------------------------+----------+--------------------------------------------------------------------------------------+

