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

Xử lý thông tin cập nhật bảo mật cấp Các thủ tục pSecurity_Assign được sử dụng trong các ví dụ trước nhiệm vụ xử lý bảo mật mới nhưng không chấp nhận điều chỉnh một thiết lập bảo mật hiện có. Việc thay đổi sau đây để kiểm tra thủ tục cho dù sự kết hợp an ninh của liên hệ và địa điểm đã có trong bảng Security, sau đó thực hiện phù hợp hoặc INSERT UPDATE | Part VII LocationCode RDBMS SecurityLevel 3 Result Server Msg 50000 Level 15 State 1 Procedure pSecurity_Assign Line 30 Location RDBMS not found Handling security-level updates The pSecurity_Assign procedure used in the previous examples handles new security assignments but fails to accept adjustments to an existing security setting. The following alteration to the procedure checks whether the security combination of contact and location is already in the Security table and then performs the appropriate INSERT or UPDATE. Security permissions may be created or adjusted with the new version of the procedure and the same parameters. Here s the improved procedure ALTER PROCEDURE pSecurity_Assign ContactCode VARCHAR 15 LocationCode VARCHAR 15 @SecurityLevel INT AS SET NOCOUNT ON DECLARE ContactID UNIQUEIDENTIFIER LocationID UNIQUEIDENTIFIER -- Get ContactID SELECT @ContactID ContactID FROM WHERE ContactCode @ContactCode IF ContactID IS NULL BEGIN RAISERROR Contact s not found 15 1 ContactCode RETURN -100 END -- Get LocationID SELECT LocationID LocationID FROM WHERE LocationCode LocationCode IF LocationID IS NULL BEGIN RAISERROR Location s not found 15 1 LocationCode RETURN -100 END 1212 Row-Level Security 52 -- IS Update or Insert IF EXISTSCSELECT FROM WHERE ContactID @ContactID AND LocationID @LocationID -- Update BEGIN UPDATE SET SecurityLevel @SecurityLevel WHERE ContactID @ContactID AND LocationID @LocationID IF ERROR 0 RETURN -100 END -- Insert ELSE BEGIN INSERT ContactID LocationID SecurityLevel VALUES @ContactID @LocationID SecurityLevel IF ERROR 0 RETURN -100 END RETURN The following script tests the new procedure s ability to modify a security permission for a contact location combination. The first command modifies contact 120 s security for location W EXEC pSecurity_Assign ContactCode 120 LocationCode W SecurityLevel 2 EXEC pSecurity_Fetch ContactCode 120 Result ContactCode .

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.