INF: Locking Behavior of Cursors on SQL Server Version 6.0ID: Q132037
|
Microsoft SQL Server version 6.0 has implemented server cursors and a user controllable setting for TRANSACTION ISOLATION LEVEL. When used together, it can be useful to know the expected locking behavior.
This document attempts to clarify the effect of optimizer hints and
isolation levels on the locking considerations of cursors. The nonlocking
parts of optimizer hints affect the cursor behavior in the following ways:
TABLE OPTIMIZER HINT
Cursor Isolation
Concurr. Level No hints NOLOCK HOLDLOCK UPDLOCK
Option
___________________________________________________________________
OPTCC Uncomm.
OPTVAL (0) Disallowed Disallowed Disallowed Disallowed
-----------------------------------------------------------
Comtd.
(1) RDL NONE SCR(sh) SCR(up)
-----------------------------------------------------------
Serial/rpt
(2) SCR(sh) NONE SCR(sh) SCR(up)
XT/C(sh) XT/C(sh) XT/C(up)
__________________________________________________________________
LOCKCC Uncomm.
(0) Disallowed Disallowed Disallowed Disallowed
-------------------------------------------------------------------
Comtd.
(1) SCR(up) NONE SCR(up) SCR(up)
-------------------------------------------------------------------
Serial/rpt
(2) SCR(up) NONE SCR(up) SCR(up)
XT/C(up) XT/C(up) XT/C(up)
___________________________________________________________________
READ Uncomm.
ONLY (0) NONE NONE SCR(sh) Disallowed
Comtd.
(1) RDL NONE SCR(sh) Disallowed
-------------------------------------------------------------------
Serial/rpt
(2) SCR(sh) NONE SCR(sh) Disallowed
XT/C(sh) XT/C(sh)
___________________________________________________________________
Part 2
TABLE OPTIMIZER HINT
Cursor Isolation
Concurr. Level TABLOCK TABLOCKX
Option
___________________________________________________________
OPTCC Uncomm.
OPTVAL (0) Disallowed Disallowed
Comtd. (inside xact only) (inside xact only)
(1) XT(tb) XT(tbx)
------------------------------------------------------------
Serial/rpt
(2) (inside xact only) (inside xact only)
XT(tb) XT(tbx)
____________________________________________________________
LOCKCC Uncomm.
(0) Disallowed Disallowed
------------------------------------------------------------
Comtd. (inside xact only) (inside xact only)
(1) XT(tb) XT(tbx)
------------------------------------------------------------
Serial/rpt
(2) (inside xact only) (inside xact only)
XT(tb) XT(tbx)
____________________________________________________________
READ Uncomm.
ONLY (0) NONE Disallowed
Comtd.
(1) NONE Disallowed
------------------------------------------------------------
Serial/rpt
(2) (inside xact only) Disallowed
XT(tb)
_______________________________________________________
NOTE: The above two tables should also fit side by side into one table.
Additional query words: Windows NT sql6 cursor lock concurrency
Keywords : kbusage SSrvWinNT
Version : 6.0
Platform : WINDOWS
Issue type :
Last Reviewed: April 16, 1999