Click or drag to resize

SA0225 : The usage of the NOLOCK and READUNCOMMITTED table hints is are deprecated in UPDATE, DELETE and MERGE statements

The topic describes the SA0225 analysis rule.

Message

The usage of the NOLOCK and READUNCOMMITTED table hints is are deprecated in UPDATE, DELETE and MERGE statements

Description

The rule checks for usage of NOLOCK and READUNCOMMITTED table hints in the FROM clause of UPDATE, DELETE or MERGE statements.

The NOLOCK and READUNCOMMITTED table hints are deprecated for usage on the target table in the FROM clause of UPDATE, DELETE and MERGE statements.

NOTE: The READUNCOMMITTED table hint produces syntax error when used with UPDATE, DELETE and MERGE statements. The NOLOCK hint produces syntax error with MERGE statement.

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

Deprecated Features

Additional Information
Example Test Script
SQL
 1UPDATE Production.Product WITH (TABLOCK, NOLOCK)
 2SET ListPrice = ListPrice * 1.10
 3WHERE ProductNumber LIKE 'BK-%';
 4
 5DELETE FROM Production.Product WITH (NOLOCK) 
 6WHERE ListPrice > 1000;
 7
 8DELETE FROM Production.Product 
 9FROM Production.Product p  WITH (NOLOCK) 
10INNER JOIN 
11Sales.ProductSales p2 ON p.ProductId = p2.ProductId
12WHERE ListPrice > 1000;

Analysis Results

 MessageLineColumn
1SA0225 : The NOLOCK is deprecated for use on the target table of UPDATE, DELETE and MERGE statements.141
2SA0225 : The NOLOCK is deprecated for use on the target table of UPDATE, DELETE and MERGE statements.537
3SA0225 : The NOLOCK is deprecated for use on the target table of UPDATE, DELETE and MERGE statements.933
See Also

Other Resources