Creare e ottimizzare i trigger in SQL Server
Florin Angelescu
Instructor
DROP TRIGGER PreventNewDiscounts;

DROP TRIGGER PreventNewDiscounts;
DROP TRIGGER PreventViewsModifications
ON DATABASE;


DROP TRIGGER PreventNewDiscounts;
DROP TRIGGER PreventViewsModifications
ON DATABASE;
DROP TRIGGER DisallowLinkedServers
ON ALL SERVER;



DISABLE TRIGGER PreventNewDiscounts
ON Discounts;
DISABLE TRIGGER PreventViewsModifications
ON DATABASE;
DISABLE TRIGGER DisallowLinkedServers
ON ALL SERVER;



ENABLE TRIGGER PreventNewDiscounts
ON Discounts;
ENABLE TRIGGER PreventViewsModifications
ON DATABASE;
ENABLE TRIGGER DisallowLinkedServers
ON ALL SERVER;



CREATE TRIGGER PreventDiscountsDelete
ON Discounts
INSTEAD OF DELETE
AS
PRINT 'Non ti è consentito eliminare dati dalla tabella Discounts.';
DROP TRIGGER PreventDiscountsDelete;
CREATE TRIGGER PreventDiscountsDelete
ON Discounts
INSTEAD OF DELETE
AS
PRINT 'Non ti è consentito rimuovere dati dalla tabella Discounts.';
CREATE TRIGGER PreventDiscountsDelete
ON Discounts
INSTEAD OF DELETE
AS
PRINT 'Non ti è consentito eliminare dati dalla tabella Discounts.';
ALTER TRIGGER PreventDiscountsDelete
ON Discounts
INSTEAD OF DELETE
AS
PRINT 'Non ti è consentito rimuovere dati dalla tabella Discounts.';
Creare e ottimizzare i trigger in SQL Server