Click or drag to resize

SA0065B : Check trigger names used in CREATE TRIGGER statements for following specified naming convention. (Batch)

The topic describes the SA0065B analysis rule.

Message

Check trigger names used in CREATE TRIGGER statements for following specified naming convention. (Batch)

Description

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.

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters
NameDescriptionDefault 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)

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

Naming Rules

Additional Information

There is no additional info for this rule.

Example Test Script
1CREATE TRIGGER safety 
2ON DATABASE 
3FOR DROP_SYNONYM
4AS 
5   RAISERROR ('You must disable Trigger "safety" to drop synonyms!',10, 1)
6   ROLLBACK

Analysis Results

 MessageLineColumn
1SA0065B : The trigger [safety] does not match the naming convention. The expected key name is [ds[A-Z][A-Za-z1-9_]+].115
See Also

Other Resources