sql server indexkey_property关键字

  SQL语法:

      INDEXKEY_PROPERTY ( object_ID ,index_ID ,key_ID ,property )

  参数

    object_id

      是表或索引视图的对象标识号。object_IDint

      index_ID
      是索引标识号。index_IDint

      key_ID
      是索引键列位置。key_IDint

      property
      是将返回其信息的属性的名称。property是一个字符串,可以是以下值之一。

 

  例子

    在以下示例中,为索引 ID表中的1键列返回这两个属性1Production.Location

    USE AdventureWorks2012;
    GO
    SELECT
      INDEXKEY_PROPERTY(OBJECT_ID('Production.Location', 'U'),
      1,1,'ColumnId') AS [Column ID],
      INDEXKEY_PROPERTY(OBJECT_ID('Production.Location', 'U'),
      1,1,'IsDescending') AS [Asc or Desc order];

  结果集:

    Column ID Asc or Desc order
    ----------- -----------------
    1 0

    (1 row(s) affected)