How to rollback or commit a transaction in SQL Server The good news is a transaction in SQL Server can span multiple batches (each exec is treated as a separate batch ) You can wrap your EXEC statements in a BEGIN TRANSACTION and COMMIT but you'll need to go a step further and rollback if any errors occur
sql server - SQL Transaction was deadlocked - Stack Overflow Sometimes I get this kind of exception on not very busy SQL server: Transaction (Process ID 57) was deadlocked on lock resources with another process and has been chosen as the deadlock victim Re
Row was updated or deleted by another transaction (or unsaved-value . . . optimistic locking consists in detecting that another transaction has updated deleted the same row, and throwing the exception you're getting in this case If you have a version field, you're already using optimistic locking, and this is what throws the exception Pessimistic locking will make your application slow and subject to deadlocks
c# - How to use TransactionScope properly? - Stack Overflow The code within the methods you call need to be transaction aware and enlist in the active transaction This means creating or using classes which are resource managers (see Implement Your Own Resource Manager You do this by implementing IEnlistmentNotification and enlisting in the transaction
Isolation Level - Serializable. When should I use this? From MSDN regarding SET TRANSACTION ISOLATION LEVEL: SERIALIZABLE Places a range lock on the data set, preventing other users from updating or inserting rows into the data set until the transaction is complete This is the most restrictive of the four isolation levels Because concurrency is lower, use this option only when necessary
Why use a READ UNCOMMITTED isolation level? - Stack Overflow In plain English, what are the disadvantages and advantages of using SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED in a query for NET applications and reporting services applications?