Skip to main content

INFORMATION.SCHEMA.KEYCOLUMNUSAGE

Class INFORMATION.SCHEMA.KEYCOLUMNUSAGE Extends %Library.Persistent [ ClassType = persistent, Final, Owner = {_PUBLIC}, SqlRowIdPrivate, SqlTableName = KEY_COLUMN_USAGE, StorageStrategy = SQLStorage, System = 4 ]

Returns one row for each columns for each UNIQUE, PRIMARY KEY, or FOREIGN KEY table constraint in the current namespace for tables that can be accessed by the current user in the current namespace. The KEY_COLUMN_USAGE table has one or more rows for each row in the TABLE_CONSTRAINTS table that has a CONSTRAINT_TYPE of "UNIQUE", "PRIMARY KEY", or "FOREIGN KEY". The rows list the columns that constitute each unique constraint, and the referencing columns in each foreign key constraint.

Parameters

READONLY

Parameter READONLY = 1;

Properties

SchemaExact

Property SchemaExact As %String(MAXLEN = 128) [ Internal, Private, Required, SqlColumnNumber = 20 ];

TableExact

Property TableExact As %String(MAXLEN = 128) [ Internal, Private, Required, SqlColumnNumber = 21 ];

ConstraintExact

Property ConstraintExact As %String(MAXLEN = 128) [ Internal, Private, Required, SqlColumnNumber = 22 ];

ColumnNameExact

Property ColumnNameExact As %String(MAXLEN = 128) [ Internal, Private, Required, SqlColumnNumber = 23 ];

SystemTable

Property SystemTable As %Integer [ Calculated, Internal, Private, Required, SqlColumnNumber = 24, SqlComputeCode = { set {*}=$s($e({SchemaExact})="%"||({SchemaExact}="INFORMATION_SCHEMA"):1,1:0) }, SqlComputed ];

Is the table a system table (1 or 0)

CONSTRAINTCATALOG

Property CONSTRAINTCATALOG As %String(MAXLEN = 128) [ Calculated, SqlColumnNumber = 2, SqlComputeCode = { set {*}=""}, SqlComputed, SqlFieldName = CONSTRAINT_CATALOG ];

Table qualifier - always NULL in InterSystems IRIS.

CONSTRAINTSCHEMA

Property CONSTRAINTSCHEMA As %String(COLLATION = "Upper", MAXLEN = 128) [ Calculated, SqlColumnNumber = 3, SqlComputeCode = { set {*}={TABLE_SCHEMA} }, SqlComputed, SqlFieldName = CONSTRAINT_SCHEMA ];

Name of schema that contains the constraint. Always the same as the TABLE_SCHEMA.

CONSTRAINTNAME

Property CONSTRAINTNAME As %String(COLLATION = "Upper", MAXLEN = 128) [ SqlColumnNumber = 4, SqlFieldName = CONSTRAINT_NAME ];

Name of the constraint.

TABLECATALOG

Property TABLECATALOG As %String(MAXLEN = 128) [ Calculated, SqlColumnNumber = 5, SqlComputeCode = { set {*}="" }, SqlComputed, SqlFieldName = TABLE_CATALOG ];

Table qualifier - always NULL in InterSystems IRIS.

TABLESCHEMA

Property TABLESCHEMA As %String(COLLATION = "Upper", MAXLEN = 128) [ Required, SqlColumnNumber = 6, SqlFieldName = TABLE_SCHEMA ];

Name of schema that contains the table.

TABLENAME

Property TABLENAME As %String(COLLATION = "Upper", MAXLEN = 128) [ Required, SqlColumnNumber = 7, SqlFieldName = TABLE_NAME ];

Name of the table.

COLUMNNAME

Property COLUMNNAME As %String(COLLATION = "Upper", MAXLEN = 128) [ Required, SqlColumnNumber = 8, SqlFieldName = COLUMN_NAME ];

Name of the column.

ORDINALPOSITION

Property ORDINALPOSITION As %Integer(MINVAL = 1) [ Required, SqlColumnNumber = 9, SqlFieldName = ORDINAL_POSITION ];

Column's ordinal position within the contraint. The value of ORDINAL_POSITION is the ordinal position of the specific column in the constraint being described. If the constraint described is a key of cardinality 1 (one), then the value of ORDINAL_POSITION is always 1 (one).

POSITIONINUNIQUECONSTRAINT

Property POSITIONINUNIQUECONSTRAINT As %Integer(MINVAL = 1) [ Calculated, SqlColumnNumber = 10, SqlComputeCode = { set {*}={ORDINAL_POSITION} }, SqlComputed, SqlFieldName = POSITION_IN_UNIQUE_CONSTRAINT ];

Referenced column's ordinal position in the referenced unique constraint.
If the constraint being described is a foreign key constraint, then the value of POSITION_IN_UNIQUE_CONSTRAINT is the ordinal position of the referenced column corresponding to the referencing column being described, in the corresponding unique key constraint.

REFERENCEDTABLECATALOG

Property REFERENCEDTABLECATALOG As %String(COLLATION = "Upper", MAXLEN = 128) [ Calculated, SqlColumnNumber = 11, SqlComputeCode = { set {*}=""}, SqlComputed, SqlFieldName = REFERENCED_TABLE_CATALOG ];

Referenced table qualifier - always NULL in InterSystems IRIS.

REFERENCEDTABLESCHEMA

Property REFERENCEDTABLESCHEMA As %String(COLLATION = "Upper", MAXLEN = 128) [ SqlColumnNumber = 12, SqlFieldName = REFERENCED_TABLE_SCHEMA ];

Name of schema that contains the table this foreign key references.

REFERENCEDTABLENAME

Property REFERENCEDTABLENAME As %String(COLLATION = "Upper", MAXLEN = 128) [ SqlColumnNumber = 13, SqlFieldName = REFERENCED_TABLE_NAME ];

Name of the table this foreign key references.

REFERENCEDCONSTRAINTNAME

Property REFERENCEDCONSTRAINTNAME As %String(COLLATION = "Upper", MAXLEN = 128) [ SqlColumnNumber = 14, SqlFieldName = REFERENCED_CONSTRAINT_NAME ];

Name of the constraint this foreign key references.

REFERENCEDCOLUMNNAME

Property REFERENCEDCOLUMNNAME As %String(COLLATION = "Upper", MAXLEN = 128) [ SqlColumnNumber = 15, SqlFieldName = REFERENCED_COLUMN_NAME ];

Name of the column this foreign key references.

CONSTRAINTTYPE

Property CONSTRAINTTYPE As %String(MAXLEN = 11, VALUELIST = ",FOREIGN KEY,UNIQUE,PRIMARY KEY,CHECK") [ Required, SqlColumnNumber = 16, SqlFieldName = CONSTRAINT_TYPE ];

CONSTRAINT_TYPE Returns one of the following values:

  • FOREIGN KEY - The constraint being described is a foreign key constraint.
  • UNIQUE - The constraint being described is a unique constraint.
  • PRIMARY KEY - The constraint being described is a primary key constraint.
  • CHECK - The constraint being described is a check constraint.