SA0070A : Check all Primary Key Constraints in the current database for following specified naming convention |
![]() |
The topic describes the SA0070A analysis rule.

Check all Primary Key Constraints in the current database for following specified naming convention

The rule checks the naming of all primary keys in the current database.
The NamePattern variable can be used to select or configure the desired pattern which will be used to check the object name.
The following placeholders will be replaced in the pattern during the key testing:
{table_name} – Name of the key’s parent table.
{column_list} – List of the key columns, ordered by key ordinal and separated by underscore(‘_’).
Regular expression patterns can be used, but the pattern must be prefixed with ‘regexp:’ string in order to be used as a matching regular expression.

Review the constraint name and rename it according to the naming convention.

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

Name | Description | Default Value |
---|---|---|
NamePattern |
Primary key name pattern. |
regexp:PK_[A-Z][A-Za-z_]+ |
ColumnsListSeparator |
Separator which to be used for separating the columns in the {column_list} placeholder. |
_ |

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


Naming Rules, Code Smells

There is no additional info for this rule.
