Click or drag to resize

SA0224 : The hint is deprecated for use on tables that are targets of INSERT statement

The topic describes the SA0224 analysis rule.

Message

The hint is deprecated for use on tables that are targets of INSERT statement

Description

The rule checks T-SQL code for usage of one of the table hints HOLDLOCK, SERIALIZABLE, READCOMMITTED, REPEATABLEREAD or UPDLOCK on the target tables of INSERT statements.

The ability to specify the HOLDLOCK, SERIALIZABLE, READCOMMITTED, REPEATABLEREAD, or UPDLOCK hints on tables that are targets of INSERT statements will be removed in a future version of SQL Server. These hints do not affect the performance of INSERT statements. Avoid using them in new development work, and plan to modify applications that currently use them.

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

New Rules, Deprecated Features

Additional Information
Example Test Script
SQL
 1INSERT INTO Sales.SalesHistory WITH (HOLDLOCK, SERIALIZABLE, READCOMMITTED, REPEATABLEREAD, UPDLOCK)  
 2    (SalesOrderID,   
 3     SalesOrderDetailID,  
 4     CarrierTrackingNumber,   
 5     OrderQty,   
 6     ProductID,   
 7     SpecialOfferID,   
 8     UnitPrice,   
 9     UnitPriceDiscount,  
10     LineTotal,   
11     rowguid,   
12     ModifiedDate)  
13SELECT * FROM Sales.SalesOrderDetail;
14
15INSERT INTO Production.Location WITH (XLOCK)  
16(Name, CostRate, Availability)  
17VALUES ( N'Final Inventory', 15.00, 80.00);

Analysis Results

 MessageLineColumn
1SA0224 : The HOLDLOCK hint is deprecated for use on tables that are targets of INSERT statement.137
2SA0224 : The SERIALIZABLE hint is deprecated for use on tables that are targets of INSERT statement.147
3SA0224 : The READCOMMITTED hint is deprecated for use on tables that are targets of INSERT statement.161
4SA0224 : The REPEATABLEREAD hint is deprecated for use on tables that are targets of INSERT statement.176
5SA0224 : The UPDLOCK hint is deprecated for use on tables that are targets of INSERT statement.192
See Also

Other Resources