TAILIEUCHUNG - Hướng dẫn học Microsoft SQL Server 2008 part 44

Như 66 Chương,''quản trị giao dịch, khóa, và chặn,''thảo luận chi tiết hơn, mỗi lệnh DML ngầm xảy ra trong vòng một giao dịch, thậm chí nếu không có lệnh GIAO DỊCH BEGIN tồn tại. Việc kích hoạt sau khi diễn ra sau khi chỉnh sửa, nhưng trước khi cam kết ngầm, do đó, giao dịch vẫn mở khi kích hoạt sau khi được phát ra | Part II Manipulating Data with Select explicitly ROLLBACK the transaction the data-modification operation will go through as originally intended. Unlike INSTEAD OF triggers AFTER triggers normally report an error code if an operation is rolled back. As Chapter 66 Managing Transactions Locking and Blocking discusses in greater detail every DML command implicitly occurs within a transaction even if no BEGIN TRANSACTION command exists. The AFTER trigger takes place after the modification but before the implicit commit so the transaction is still open when the AFTER trigger is fired. Therefore a transaction ROLLBACK command in the trigger will roll back all pending transactions. This code sample creates the AfterDemo AFTER trigger on the Guide table which includes the RAISERROR and ROLLBACK TRANSACTION commands USE CHA2 CREATE TRIGGER AfterDemo ON Guide AFTER INSERT UPDATE AS Print After Trigger Demo -- logic in a real trigger would decide what to do here RAISERROR Sample Error 16 1 ROLLBACK TRAN With the AFTER trigger applied to the Guide table the following INSERT will result INSERT Guide lastName FirstName Qualifications DateOfBirth DateHire VALUES Harrison Nancy Pilot Sky Diver Hang Glider Emergency Paramedic 19690625 20000714 Result After Trigger Demo Server Msg 50000 Level 16 State 1 Procedure AfterDemo Line 7 Sample Error A SELECT searching for Nancy Harrison would find no such row because the AFTER trigger rolled back the transaction. Note that the sample code in the file for this chapter drops the AfterDemo trigger so that the code in the remainder of the chapter will function. Non-Updateable Views Non-updateable views may affect INSERT UPDATE and DELETE operations. Several factors will cause a view to become non-updateable. The most common causes of non-updateable views are aggregate functions including DISTINCT group bys and joins. If the view 392 Modification Obstacles 16 includes other nested views any nested view that is .

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.