TAILIEUCHUNG - Instructor Inputs - Session 15

The management of AdventureWorks, Inc. has decided that no user should be able to change the prices of the products. In addition, management wants that all the attempts to change the price should be saved in a temporary table, Temp. John, the database developer has been asked to make the significant changes in the database to implement this policy. What can John do to achieve the same? | Instructor Inputs Session 15 Solutions to Exercises This session includes exercises of Chapter 8 Chapter 9 and Chapter 10. Chapter 8 Exercise 1 The management of AdventureWorks Inc. has decided that no user should be able to change the prices of the products. In addition management wants that all the attempts to change the price should be saved in a temporary table Temp. John the database developer has been asked to make the significant changes in the database to implement this policy. What can John do to achieve the same Solution To accomplish this task John needs to create an update trigger on the ProductCostHistory table. In addition he also needs to create a temporary table to store the changes in it. To create the temporary table John needs to execute the following statements in the SQL Server Management Studio CREATE TABLE Temp ProductID int AttChangeCost money AttTime datetime To create the update trigger on the ProductCostHistory John needs to execute the following statements CREATE TRIGGER updTrigger ON Production . ProductCostHistory INSTEAD OF UPDAtE AS BEGIN DECLARE @PID AS int DECLARE @COST AS money SELECT @pid ProductID @cost StandardCost FROM Deleted INSERT INTO Temp VALUES @pid @cost getdate SELECT Sorry you can not change the price of a Product END NIIT Instructor Inputs .

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.