Using holdlock, noholdlock, or shared

You can override a session’s locking level by applying the holdlock, noholdlock, and shared options to individual tables in select or readtext commands:

Level to use

Keyword

Effect

1

noholdlock

Do not hold locks until the end of the transaction; use from level 3 to enforce level 1.

2, 3

holdlock

Hold shared locks until the transaction completes; use from level 1 to enforce level 3.

N/A

shared

Applies shared rather than update locks for select statements in cursors open for update.

These keywords affect locking for the transaction: if you use holdlock, all locks are held until the end of the transaction.

If you specify holdlock in a query while isolation level 0 is in effect for the session, Adaptive Server issues a warning and ignores the holdlock clause, not acquiring locks as the query executes.

If you specify holdlock and read uncommitted, Adaptive Server prints an error message, and the query is not executed.