现在有这样一个表 person(id,name),要想实现以下操作:
更新时,数据变为最后一个线程更改的数据
sql语句实现如下(有事务):
操作 隔离级别 sql语句
getmaxid read nucommitted select max(id) from person with(rowlock)
insert read committed insert into person with(updlock,rowlock) (后省略)
update read committed update person with(updlock,rowlock) (后省略)
delete read committed delete person with(holdlock,rowlock)(后省略)
select read nucommitted select * from with(rowlock)(后省略)
请问这样能实现吗?或者有更好的实现方式吗?