【发布时间】:2018-11-09 16:42:41
【问题描述】:
在下面的示例中,当使用with (tablockx) 时,锁定是在选择确定最大值之前完成还是之后完成?插入到表“table1”中的插入语句是否存在竞争条件,或者是否保证@foo 将包含在表中找到的最大值,直到事务提交或回滚?
begin Transaction
declare @foo int = (select max(col1) from table1 with (tablockx))
-- Is it possible that max(col1) can be > @foo here?
Commit Transaction
如果重要的话,我使用的是 SQL Server 2008 R2
【问题讨论】:
标签: sql-server sql-server-2008-r2