Send feedback on this topic.
Teradata.Client.Provider
Foreign Keys Schema Collection
.NET Data Provider for Teradata > Developer's Guide > Working with the Data Provider Features > Schema Collections > Foreign Keys Schema Collection

ForeignKeys schema collection returns information about FOREIGN KEY constraints by accessing the Advanced SQL Engine Data Dictionary views. It will access DBC.ALL_RI_PARENTS[V]X if UseXViews is set to true; otherwise it will access DBC.ALL_RI_PARENTS[V] Data Dictionary view.

Column Name Data Type Description
PK_TABLE_CATALOG String This field is always set to EMPTY.
PK_TABLE_SCHEMA String Returns the name of the DATABASE in which PRIMARY KEY (PARENT TABLE) TABLE object resides.
PK_TABLE_NAME String Returns the name of the PRIMARY KEY TABLE object.
PK_COLUMN_NAME String Returns the name of the Column in the Primary Key.
FK_TABLE_CATALOG String This field is always set to EMPTY.
FK_TABLE_SCHEMA String Returns the name of the DATABASE in which the FOREIGN KEY (REFERENCING TABLE) TABLE object resides.
FK_TABLE_NAME String Returns the name of the FOREIEGN KEY (REFERENCING) TABLE object.
FK_COLUMN_NAME String Returns the name of the Column in the Foreign Key.
ORDINAL_POSITION Int16 Returns the position of the column in the Primary Key. For a composite Primary Key, this indicates the order of the columns making up the Primary Key.
INDEX_NAME String Returns the Primary Key name. This field is NULL if the Primary Key does not have a name.
INDEX_NUMBER Int16 Returns an internal number assigned to the index.


ForeignKeys schema collection can be filtered or restricted to:

Restriction Column Name Restriction Number Description
FK_TABLE_SCHEMA 1 This restriction can be set to a valid DATABASE object name.
FK_TABLE_SCHEMA 2 This restriction can be set to a valid TABLE object name.
PK_TABLE_NAME 3 This restriction can be set to a valid TABLE object name.
INDEX_NUMBER 4 This restriction can be set to a valid INDEX NUMBER.
FK_COLUMN_NAME 5 This restriction can be set to a valid COLUMN name.
PK_TABLE_SCHEMA 6 This restriction can be set to a valid DATABASE object name.


ForeignKeys schema collection rows are ordered by:

Column Name Description
FK_TABLE_SCHEMA Ascending case sensitive sort order. For example A through Z followed by a through z.
FK_TABLE_NAME Ascending case sensitive sort order.
INDEX_NUMBER Ascending sort order.