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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.