我在并发事务查询中遇到麻烦

时间:2020-02-05 17:06:42

标签: sql concurrency transactions

我为并发事务编写了以下查询

Select * from Accounts
-- Transfer $ 100 from Mark to Mary

Begin Try 
    Begin Transaction
    update Accounts Set Balance = Balance=100 Where ID= 1
    update accounts set balance = balance=100 Where ID = 2
    Commit Transaction
    Print ' Transaction Committed '
End Try 
Begin CATCH
    Rollback Transaction
    Print ' Transaction Rolled back '
End CATCH

0 个答案:

没有答案