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

hông được kiểm soát dữ liệu Để hiểu được sự cần thiết của VỚI CHECK OPTION, điều quan trọng là đầu tiên hiểu thế nào mà không có chức năng xem CHECK OPTION. Quan điểm sau đây sẽ tạo ra một danh sách các tour du lịch cho các trại Cape Hatteras cơ sở: | Part II Manipulating Data with Select Unchecked data To understand the need for the WITH CHECK OPTION it s important to first understand how views function without the CHECK OPTION. The following view will generate a list of tours for the Cape Hatteras base camp USE CHA2 CREATE VIEW AS SELECT TourName BaseCampID FROM WHERE BaseCampID 2 go SELECT TourName BaseCampID FROM TourName BaseCampID Outer Banks Lighthouses 2 If the Ashville base camp adds a Blue Ridge Parkway Hike tour and inserts it through the view without the CHECK OPTION the INSERT is permitted INSERT TourName BaseCampID VALUES Blue Ridge Parkway Hike 1 1 row s affected The INSERT worked and the new row is in the database but the row is not visible through the view because the WHERE clause of the view filters out the inserted row. This phenomenon is called disappearing rows SELECT TourName BaseCampID FROM TourName BaseCampID Outer Banks Lighthouses 2 If the purpose of the view were to give users at the Cape access to their tours alone then the view failed. Although they can see only the Cape s tours they successfully modified another base camp s tours. The WITH CHECK OPTION would have prevented this fault. Protecting the data A view with a WHERE clause and the WITH CHECK OPTION can protect the data from undesired inserts and updates. The following code will back out the previous INSERT and redo the same scenario but this time the view will include the WITH CHECK OPTION DELETE WHERE TourName Blue Ridge Parkway Hike 342 Projecting Data Through Views 14 go ALTER VIEW AS SELECT TourName BaseCampID FROM WHERE BaseCampID 2 WITH CHECK OPTION go INSERT TourName BaseCampID VALUES Blue Ridge Parkway Hike 1 Server Msg 550 Level 16 State 1 Line 1 The attempted insert or update failed because the target view either specifies .

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.