SqlServer事务中的可重复读和序列化隔离界别
程序员文章站
2022-06-05 14:56:13
...
有表t_lock: ID是主键,表中有5行数据,1~2,4~6 可重复读: SET TRANSACTION ISOLATION LEVEL REPEATABLE READ begin tran select * from t_lock where id between 1 and 6 执行这个查询后,会在表ID为1,2,4,5,6的行上加上共享锁(s) 执行插入语句 insert
有表t_lock:
ID是主键,表中有5行数据,1~2,4~6
可重复读:
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ
begin tran
select * from t_lock where id between 1 and 6