Mutex analog in SQL?

2019-02-20 02:39发布

问题:

I have multiple threads, executing similar queries. They shouldn't be executed the same time. I can create and check mutex for this purpose from ADO.Net client, but for some reason I'd prefer to do this using SQL. Is it possible?

Regards,

回答1:

Yes it is. Application Locks (or Mutexes) in SQL Server 2005



回答2:

Use the locking available in SQL Server:

Introduction to Locking in SQL Server