开始使用免费开始使用

禁止更改 Products

Fresh Fruit Delivery 公司不希望普通用户能够更改产品信息或实际库存。

本练习是课程的一部分

在 SQL Server 中构建与优化触发器

查看课程

练习说明

  • 创建一个新的触发器 PreventProductChanges,用于阻止对 Products 表的任何更新。

交互式实操练习

通过完成这段示例代码来试试这个练习。

-- 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);
编辑并运行代码