TAILIEUCHUNG - Microsoft SQL Server 2008 R2 Unleashed- P108

Microsoft SQL Server 2008 R2 Unleashed- P108:SQL Server 2005 provided a number of significant new features and enhancements over what was available in SQL Server 2000. This is not too surprising considering there was a five-year gap between these major SQL Server 2008 is not as much of a quantum leap forward from SQL Server 2005 | 1014 CHAPTER 31 Transaction Management and the Transaction Log IF @@error 0 BEGIN ROLLBACK TRAN mytran RETURN -1969 END I I Once you reach the end of the code you need to pair the BEGIN TRAN if you issued it with a COMMIT TRAN. If you executed the SAVE TRAN instead you have nothing else to of game IF @trancount 0 COMMIT TRAN RETURN 0 If you apply these concepts to all stored procedures that need to incorporate transaction processing as well as the code that calls the stored procedures you should be able to avoid problems with transaction nesting and inconsistency in your transaction processing. You just need to be sure to check the return value of the stored procedure and determine whether the whole batch should be failed or whether that one call is of little importance to the overall outcome and the transaction can continue. For additional examples of and discussion about coding guidelines for stored procedures in transactions see Chapter 44 Advanced Stored Procedure Programming and Optimization. Transactions and Triggers SQL Server 2008 provides two types of Data Manipulation Language DML triggers AFTER and INSTEAD OF. INSTEAD OF triggers perform their actions before any modifications are made to the actual table the trigger is defined on. Whenever a trigger is invoked it is always invoked within another transaction whether it s a single-statement AutoCommit transaction or a user-defined multistatement transaction. This is true for both AFTER triggers and INSTEAD OF triggers. Even though an INSTEAD OF trigger fires before or instead of the data modification statement itself if a transaction is not already active an AutoCommit transaction is still automatically initiated as the data modification statement is invoked and prior to the invocation of the INSTEAD OF trigger. For more information on AFTER and INSTEAD OF triggers see Chapter 30 Creating and Managing Triggers. NOTE Although the information presented in this section applies to both AFTER and INSTEAD

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.