Locking a BEGIN TRAN | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Locking a BEGIN TRAN

Is there a method to lock a table accross BEGIN TRAN / COMMIT TRAN ? I’d like to ensure that no INSERTS are performed accross a several-T-SQL-step procedure. Sam
Use the query hints HOLDLOCK and TABLOCK.
There is also TABLOCKX if you want to ensure there will be no writes AND reads. — Marek ‘chopeen’ Grzenkowicz, MCP
Poland
]]>