The transaction isolation level read uncommited or repetable because of inconsitent results

tsql

(Christian Rohr ) #1

A good rule suggestion:
description of the Rule answering to the question “why?” : what’s the impact to keep this code as it is ?
Avoid using transaction isolation level read uncommited or repeatable read because of ending in inconsistent
results, in functions or stored procedures
snippet of Noncompliant Code

CREATE PROCEDURE dbo.Test 
BEGIN
  SET TRANSACTION ISOLATION LEVEL READ UNCOMMITED
END
  • snippet of Compilant Code (fixing the above noncompliant code)
CREATE PROCEDURE dbo.Test
BEGIN  

END

or

CREATE PROCEDURE dbo.Test
BEGIN  
    SET TRANSACTION ISOLATION LEVEL SNAPSHOT (READ COMMIT, etc.)
END

external references and/or language specifications
https://docs.microsoft.com/de-de/sql/t-sql/statements/set-transaction-isolation-level-transact-sql?view=sql-server-2017
type : Bug, Vulnerability, Code Smell ?
bug/code smell
tags tsql