Click or drag to resize

EX0006 : Identify possible missing Foreign Keys

The topic describes the EX0006 analysis rule.

Message

Identify possible missing Foreign Keys

Description

The rule checks database tables for columns which do not have a foreign key reference, but match by name pattern and data type to a primary key of a different table.

For example:

  • When using pattern '{column_name}':

    The rule will match and suggest adding foreign key to [Sales].[SalesOrderDetailPartitioned].[SpecialOfferID] referencing [Sales].[SalesOrderDetailPartitioned].[SpecialOfferID].

  • When using pattern '{table_name}{column_name}':

    The rule will match and suggest adding foreign key to dbo.[Sale].[CustomerID] referencing dbo.[Customer].[ID].

  • When using pattern 'FK_{table_name}_{column_name}':

    The rule will match and suggest adding foreign key to dbo.[Sale].[ID] referencing dbo.[Customer].[FK_Sale_ID].

Scope

The rule has a ContextOnly scope and is applied only on current server and database schema.

Parameters
NameDescriptionDefault Value
ForeignKeyColumnNamePattern

Foreign key column name pattern.

{column_name}

Remarks

The rule requires Analysis Context. If context is missing, the rule will be skipped during analysis.

Categories

Design Rules, Explicit Rules

Additional Information

There is no additional info for this rule.

See Also

Other Resources