The IN_DB_UTIL_SP_GET_FK_DDL stored procedure generates and displays the foreign key DDL for the specified foreign key name or all the foreign keys for the specified table depending on the SCOPE.
Parameter | Description | |
---|---|---|
TABLE_NAME | Type: | INPUT |
Datatype: | SYSNAME | |
Default Value: | NULL | |
Description | The table name for which to generate the foreign key DDL. | |
Options | Any valid table in the inuser schema. | |
FK_NAME | Type: | INPUT |
Datatype: | SYSNAME | |
Default Value: | NULL | |
Description | The foreign key name for which to generate the DDL. If the FK_NAME is not specified then all foreign keys on the specified table that reference other tables is displayed (SCOPE=FROM). | |
Options | Any valid foreign key for the specified table. | |
SCOPE | Type: | INPUT |
Datatype: | NVARCHAR(4) | |
Default Value: | NULL | |
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 INT EXEC @V_RETURN_VAL = IN_GET_FK_DDL 'IN_DOC' PRINT @V_RETURN_VAL EXEC IN_GET_FK_DDL 'IN_DOC' EXEC IN_GET_FK_DDL 'IN_DOC', 'FK_DOC_INSTANCE_ID' [, 'FROM'] EXEC IN_GET_FK_DDL 'IN_DOC', NULL, 'FROM' EXEC IN_GET_FK_DDL 'IN_DOC', NULL, 'TO' EXEC IN_GET_FK_DDL 'IN_DOC', NULL, 'ALL'