SA0065B : Check trigger names used in CREATE TRIGGER statements for following specified naming convention |
The topic describes the SA0065B analysis rule.
Check trigger names used in CREATE TRIGGER statements for following specified naming convention
The rule checks trigger names used in CREATE TRIGGER statements.
Separate name patterns are available for table triggers and database, or server triggers.
For table triggers, a schema qualified name pattern is also available.
The following placeholders will be replaced in the pattern during the key testing:
{table_name}
{trigger_events}
{schema_name}
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 trigger name and rename it according to the naming convention.
The rule has a Batch scope and is applied only on the SQL script.
Name | Description | Default Value |
---|---|---|
DmlTriggerNamePattern |
Table triggers name pattern. |
trig_{trigger_events}{table_name} |
DmlTriggerSchemaQualifiedNamePattern |
DmlTrigger schema qualified name pattern. |
– |
DdlTriggerNamePattern |
Database and server triggers name pattern. |
regexp:{trigger_events}[A-Z][A-Za-z1-9_]+ |
InsertEventName |
Event name which to be used in the {trigger_events} placeholder for the specific event type. |
i |
UpdateEventName |
Event name which to be used in the {trigger_events} placeholder for the specific event type. |
u |
DeleteEventName |
Event name which to be used in the {trigger_events} placeholder for the specific event type. |
d |
TriggerEventsListSeparator |
Separator for the event in the {trigger_events} placeholder. |
|
DdlTriggerEventNames |
Specifies how the trigger event types are set in the {trigger_events} placeholder. |
Use first letter of each word (lowercase) |
The rule does not need Analysis Context or SQL Connection.
Naming Rules, Code Smells
There is no additional info for this rule.
SQL
1CREATE TRIGGER safety 2ON DATABASE 3FOR DROP_SYNONYM 4AS 5 RAISERROR ('You must disable Trigger "safety" to drop synonyms!',10, 1) 6 ROLLBACK |
Message | Line | Column | |
---|---|---|---|
1 | SA0065B : The trigger [safety] does not match the naming convention. The expected key name is [ds[A-Z][A-Za-z1-9_]+]. | 1 | 15 |