--放到一个事务处理,事务处理完成后,自动释放锁
begin tran
--更新处理
update a set a='x' from ta a WITH (XLOCK)
update b set a='x' from tb b WITH (XLOCK)
commit tran
begin tran
--更新处理
update a set a='x' from ta a WITH (XLOCK)
update b set a='x' from tb b WITH (XLOCK)
commit tran
能具体说详细点吗,我对数据库了解得浅显。
例如,表: TA,TB;
我需要往TA,TB中分别加入一条记录
在我完成操作的过程中,其他地方不能修改这两张表的任何一张,访问可以。