Locking Hints

Locking hints are T-SQL keywords that can be used with SELECT, INSERT, UPDATE, and DELETE statements to direct SQL Server to use a preferred type of locking behavior for locks on a particular table or view. Locking hints on views are propagated to all the tables and/or views that are referenced by that view. You can use locking hints to override the default transaction isolation level. You should use this technique only when absolutely necessary because if you’re not careful, you could cause blocking or deadlocks.

The following list describes the available table-level locking hints:

  • HOLDLOCK. Holds shared locks until the completion of a transaction rather than releasing them as soon they are no longer needed. Equivalent to using the ...

Get Microsoft® SQL Server™ 2005 Administrator's Companion now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.