BaşlayınÜcretsiz Başlayın

Creating the PreventNewDiscounts trigger

The company doesn't want regular users to add discounts. Only the Sales Manager should be able to do that.

To prevent such changes, you need to create a new trigger called PreventNewDiscounts.

The trigger should be attached to the Discounts table and prevent new rows from being added to the table.

Bu egzersiz

Building and Optimizing Triggers in SQL Server

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create the trigger PreventNewDiscounts on the Discounts table.
  • Set the trigger to prevent any rows being added to the Discounts table.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

-- Create a new trigger
___ ___ ___
ON ___
___ ___ ___
AS
	RAISERROR ('You are not allowed to add discounts for existing customers.
                Contact the Sales Manager for more details.', 16, 1);
Kodu Düzenle ve Çalıştır