How do you lock tables in SQL Server 2005, and should I even do it?

后端 未结 7 1980
醉话见心
醉话见心 2021-02-19 15:35

This one will take some explaining. What I\'ve done is create a specific custom message queue in SQL Server 2005. I have a table with messages that contain timestamps for both a

相关标签:
7条回答
  • 2021-02-19 16:22

    @Kilhoffer:

    The whole SQL batch is parsed before execution, so SQL knows that you're going to do an update to the table as well as select from it.

    Edit: Also, SQL will not necessarily lock the whole table - it could just lock the necessary rows. See here for an overview of locking in SQL server.

    0 讨论(0)
提交回复
热议问题