Get startedGet started for free

Preventing changes to Products

The Fresh Fruit Delivery company doesn't want regular users to be able to change product information or the actual stock.

This exercise is part of the course

Building and Optimizing Triggers in SQL Server

View Course

Exercise instructions

  • Create a new trigger, PreventProductChanges, that prevents any updates to the Products table.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- 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);
Edit and Run Code