Can I Select and Update at the same time?

后端 未结 6 1662
梦谈多话
梦谈多话 2021-01-19 00:07

This is an over-simplified explanation of what I\'m working on.
I have a table with status column. Multiple instances of the application will pull the contents of the f

6条回答
  •  春和景丽
    2021-01-19 00:30

    Sounds like a queue processing scenario, whereby you want one process only to pick up a given record.

    If that is the case, have a look at the answer I provided earlier today which describes how to implement this logic using a transaction in conjunction with UPDLOCK and READPAST table hints: Row locks - manually using them

    Best wrapped up in sproc.

    I'm not sure this is what you are wanting to do, hence I haven't voted to close as duplicate.

提交回复
热议问题