Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

How to Lock a table on purpose without returning results?

Asked by Akash Mishra Apr 24, 2021 1.6K views 1 answer
Share

About this question

Here 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?

empty result in ssms

What is sql server lock table?

Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.