jackysuy 2017-01-15 02:46 采纳率: 0%
浏览 1348

数据库 事务死锁 问题如何解决

事务1
BEGIN TRAN
update T_Users set Money=Money+1 where ID=1001
WAITFOR DELAY '00:00:10' --等待10秒
update T_Users set Money=Money-1 where ID=1000
COMMIT TRAN

事务2
BEGIN TRAN
update T_Users set Money=Money+1 where ID=1000
WAITFOR DELAY '00:00:10' --等待10秒
update T_Users set Money=Money-1 where ID=1001
COMMIT TRAN

1001和1000是上下级关系,经常同时互相存取账。造成死锁,如何解决

  • 写回答

1条回答 默认 最新

  • devmiao 2017-01-15 07:25
    关注
    评论

报告相同问题?