The IN_DB_UTIL_SP_GET_FK_INFO stored procedure lists the foreign key constraints that currently exist for the specified table. It also displays the current status of the foreign keys, indicating if the FK is enabled/disabled (is_disabled) and whether it is verified/not verified (is_not_trusted).
By default, the procedure will display the status of the foreign keys to and from the specified table (SCOPE = ‘ALL’).
Parameter | Description | |
---|---|---|
TABLE_NAME | Type: | INPUT |
Datatype: | SYSNAME | |
Default Value: | NULL | |
Description | The name of the table for which to get the foreign key information. This parameter is required. | |
Options | Any valid table in the inuser schema. | |
FK_NAME | Type: | INPUT |
Datatype: | SYSNAME | |
Default Value: | NULL | |
Description | The name of the foreign key constraint for which to get the information to display. If the foreign key name is not specified then all foreign keys for the specified table will be generated and displayed (SCOPE = ALL). | |
Options | Any valid foreign key for the specified table. | |
SCOPE | Type: | INPUT |
Datatype: | NVARCHAR(4) | |
Default Value: | ALL | |
Description | The scope of the foreign keys, in relation to the specified table. | |
Options |
TO = Foreign keys that reference the specified table. FROM = Foreign keys on the specified table that reference other tables. ALL = All foreign keys TO and FROM the specified table. |
|
DEBUG | Type: | INPUT |
Datatype: | NVARCHAR(3) | |
Default Value: | NO | |
Description | Specifies whether to display the procedure name during execution. | |
Options |
YES NO |
|
V_RETURN_VAL | Type: | OUTPUT |
Datatype: | INTEGER | |
Default Value: | 0 | |
Description | Specifies whether the execution of the procedure was successful or not. 0 = Success 1 = Error |
Examples
DECLARE @V_RETURN_VAL INTEGER EXEC @V_RETURN_VAL = IN_GET_FK_INFO 'IN_DOC' PRINT @V_RETURN_VAL EXEC IN_GET_FK_INFO 'IN_DOC'
Example Output
Referential Integrity (FK) Constraints for the inuser.IN_DOC table: inuser.IN_DOC References: Foreign Key FK_D_DOC_TYPE_ID References PK_DOC_TYPE is ENABLED and VERIFIED Foreign Key FK_DOC_DRAWER_ID References PK_DRAWER is ENABLED and VERIFIED Foreign Key FK_DOC_INSTANCE_ID References PK_INSTANCE is ENABLED and VERIFIED inuser.IN_DOC Referenced By: Table IN_DOC_CONTENT Foreign Key FK_DC_DOC_ID References PK_DOC is ENABLED and VERIFIED Table IN_DOC_KW Foreign Key FK_DK_DOC_ID References PK_DOC is ENABLED and VERIFIED Table IN_RC_RECORD_DOC Foreign Key FK_RCRD_D_ID References PK_DOC is ENABLED and VERIFIED Table IN_SIG Foreign Key FK_S_DOC_ID References PK_DOC is ENABLED and VERIFIED Table IN_TASK Foreign Key FK_T_DOC_ID References PK_DOC is ENABLED and VERIFIED Table IN_VERSION Foreign Key FK_V_DOC_ID References PK_DOC is ENABLED and VERIFIED