.. _sql_server_foreign_key_columns(SQLServer):

sys.foreign_key_columns
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

包含有关数据库内的表定义中的 FOREIGN KEY 约束的信息。

.. table:: sys.foreign_key_columns 列
      :widths: 3 2 4
      :class: longtable
   
      +----------------------+----------+-----------------------------------------------------------+
      | 名称                 | 数据类型 | 描述                                                      |
      +======================+==========+===========================================================+
      | constraint_object_id | oid      | 约束的id                                                  |
      +----------------------+----------+-----------------------------------------------------------+
      | constraint_column_id | int      | 组成 FOREIGN KEY（1..n，其中 n 为列数）的列或列集的列号   |
      +----------------------+----------+-----------------------------------------------------------+
      | parent_object_id     | oid      | 具有该约束的表的id                                        |
      +----------------------+----------+-----------------------------------------------------------+
      | parent_column_id     | int      | 该表中作为外键列的列号                                    |
      +----------------------+----------+-----------------------------------------------------------+
      | referenced_object_id | oid      | 约束引用的表的id                                          |
      +----------------------+----------+-----------------------------------------------------------+
      | referenced_column_id | int      | 被引用列（候选键列）的列号                                |
      +----------------------+----------+-----------------------------------------------------------+


