Working with Database Transactions

Any single SQL statement (a single unit of work), whether it affects one row or thousands of rows within a table, is considered to be a transaction. Therefore, in Microsoft SQL Server, transactions are implied in every SQL statement. However, as a SQL programmer, you may want to control your own transactions specifying that a series of SQL statements all be performed, or that the entire series be rolled back if any one of them fails. You can do this by specifying where a transaction starts and where it ends. You must also correctly handle errors that may occur and terminate transactions when necessary. Remember that transactions are started on a connection and managed at a connection level. What this means is ...

Get Sams Teach Yourself Microsoft® Windows® DNA Programming in 21 Days now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.