Click or drag to resize

SA0241 : Check transaction and savepoint names for following specified naming convention

The topic describes the SA0241 analysis rule.

Message

Check transaction and savepoint names for following specified naming convention

Description

The rule checks T-SQL code for transaction and savepoint names and reports names, which do not match the configured name patterns.

Check the rule parameters for configuring the available name pattern parameters.

Scope

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

Parameters
NameDescriptionDefault Value
TransactionNamePattern

Transaction name pattern.

regexp:[A-Z][A-Za-z_]+

SavepointNamePattern

Savepoint name pattern.

regexp:[A-Z][A-Za-z_]+

DistributedTransactionNamePattern

Distributed transaction name pattern.

regexp:[A-Z][A-Za-z_]+

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

Naming Rules, New Rules

Additional Information

There is no additional info for this rule.

Example Test Script
SQL
 1BEGIN DISTRIBUTED TRAN  TRAN1
 2COMMIT TRAN TRAN1
 3
 4BEGIN TRANSACTION TRAN_1
 5SAVE TRANSACTION TRAN_1_SAVEPOINT
 6ROLLBACK TRAN TRAN_1
 7
 8DECLARE @TranName VARCHAR(20);  
 9SELECT @TranName = 'TRAN_3a';  
10SET @TranName = 'TRAN_3b';  
11BEGIN TRANSACTION @TranName;  
12COMMIT TRANSACTION @TranName;

Analysis Results

 MessageLineColumn
1SA0241 : The distributed transaction name [TRAN1] does not match the naming convention. The expected key name is [[A-Z][A-Za-z_]+].124
2SA0241 : The transaction name [TRAN_1] does not match the naming convention. The expected key name is [[A-Z][A-Za-z_]+].418
3SA0241 : The savepoint name [TRAN_1_SAVEPOINT] does not match the naming convention. The expected key name is [[A-Z][A-Za-z_]+].517
4SA0241 : The transaction name [TRAN_3b] does not match the naming convention. The expected key name is [[A-Z][A-Za-z_]+].1118
See Also

Other Resources