In an update script I'm locking several tables.
BEGIN TRANSACTION
SELECT Top 0 Null FROM TableA with (holdlock, tablockx)
SELECT Top 0 Null FROM TableB with (holdlock, tablockx)
...
I want to suppress results for it in order to focus on real script results. Is there an elegant way to xlock a table without getting a result set?
Best Answer
There may be other ways, but this technique seems simple enough: