SA0138 : BEGIN TRANSACTION statement without ROLLBACK statement

The topic describes the SA0138 analysis rule.

Message

BEGIN TRANSACTION statement without ROLLBACK statement

Description

The rule checks T-SQL code for BEGIN TRANSACTION statement, which is not followed by a ROLLBACK statement.

While ROLLBACK statement is not required, it is necessary for good error handling practices.

Scope

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

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

Design Rules

Additional Information
Example Test Script
SQL
1BEGIN TRANSACTION
2
3ROLLBACK
4
5BEGIN TRANSACTION

Analysis Results

  Message Line Column
1 SA0138 : BEGIN TRANSACTION statement without ROLLBACK statement. 5 0
See Also

Other Resources