J
James Palmer
Guest
If you were to have the for each with a no-lock and do some work on a sub record inside the for each then the transaction would be scoped to the sub block, and a subsequent undo would only undo the last transaction. But if you specify the transaction keyword on the for each you are extending the scope to that block. But in your case, yes the transaction keyword does seem a little redundant. All the same it could be there for readability. As a side note, and I don't mean to patronise, transactions scoped to a whole for each should be avoided if at all possible. You run the risk of blowing the lock table, and leaving many records locked for other users whilst the transaction is ongoing. Do your for each no lock, and then find a named buffer exclusive lock within the for each to make your changes. That way your transaction scope is really tight and you won't run into these sorts of problems. I realise this is a lot easier to say in theory than in practise!
Continue reading...
Continue reading...