在使用 MySQL 时,我们有时会遇到这样的报错:“Deadlock found when trying to get lock; try restarting transaction”. 在 14.5.5.3 How to Minimize and Handle Deadlocks 中有这样一句话: Deadlocks are not dangerous. Just try again. 死锁不危险,重试一下就行. 实际上这个建议非常实用. 我们回顾一下死锁发生的四个条件: 资源的独占性(在某
UPDATE:UPDATE A SET ApproverID=NULL FROM [SH_MaterialApplyBuyBill] A LEFT JOIN [SH_MaterialApplyBuyBillDetail] B ON A.ID=B.[MaterialApplyBuyBillID]WHERE A.id=125 AND @InDetailCount=0DELETE:DELETE A FROM [SH_ClosingBalance] A LEFT JOIN [SH_StoreHouse]