防止變更 Products
Fresh Fruit Delivery 公司不希望一般使用者能夠變更產品資訊或實際庫存。
本練習屬於課程
在 SQL Server 建立與最佳化觸發程序
練習說明
- 建立一個新的觸發程序
PreventProductChanges,用來防止對Products資料表進行任何 UPDATE。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
-- Prevent any product changes
CREATE TRIGGER ___
ON ___
___ ___ UPDATE
AS
RAISERROR ('Updates of products are not permitted. Contact the database administrator if a change is needed.', 16, 1);