If I want to do something like the following:
1. Add new records into Table_A
2. Update the value of [Field1] in Table_A to = "SET"
3. Update the value of [Field2] in Table_A where [Field1] is equal to "Set"
Can I do all of that inside a transaction, or will it be the case that the updated values of [Field1] will not be visible to the update query in point 3. as the transaction has not yet been committed?
I already have something similar, but one of the queries is failing with an ODBC timeout (it's an SQL Server database) as a table it uses is locked. That same table has been updated by queries earlier in the Transaction, so I think it is because I have not yet committed the transaction (so the updated table remains locked).
If this last query fails I want to rollback the whole lot. How can I get around this?
Nested Transactions maybe?
1. Add new records into Table_A
2. Update the value of [Field1] in Table_A to = "SET"
3. Update the value of [Field2] in Table_A where [Field1] is equal to "Set"
Can I do all of that inside a transaction, or will it be the case that the updated values of [Field1] will not be visible to the update query in point 3. as the transaction has not yet been committed?
I already have something similar, but one of the queries is failing with an ODBC timeout (it's an SQL Server database) as a table it uses is locked. That same table has been updated by queries earlier in the Transaction, so I think it is because I have not yet committed the transaction (so the updated table remains locked).
If this last query fails I want to rollback the whole lot. How can I get around this?
Nested Transactions maybe?