删除与修改触发器

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

Florin Angelescu

Instructor

删除表与视图触发器

DROP TRIGGER PreventNewDiscounts;

表

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

删除数据库触发器

DROP TRIGGER PreventNewDiscounts;
DROP TRIGGER PreventViewsModifications
ON DATABASE;

表

数据库

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

删除服务器触发器

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

表

数据库

服务器

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

禁用触发器

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

表

数据库

服务器

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

启用触发器

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

表

数据库

服务器

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

修改触发器

CREATE TRIGGER PreventDiscountsDelete
ON Discounts
INSTEAD OF DELETE
AS
    PRINT 'You are not allowed to data from the Discounts table.';
DROP TRIGGER PreventDiscountsDelete;
CREATE TRIGGER PreventDiscountsDelete
ON Discounts
INSTEAD OF DELETE
AS
    PRINT 'You are not allowed to remove data from the Discounts table.';
在 SQL Server 中构建与优化触发器

修改触发器

CREATE TRIGGER PreventDiscountsDelete
ON Discounts
INSTEAD OF DELETE
AS
    PRINT 'You are not allowed to data from the Discounts table.';
ALTER TRIGGER PreventDiscountsDelete
ON Discounts
INSTEAD OF DELETE
AS
    PRINT 'You are not allowed to remove data from the Discounts table.';
在 SQL Server 中构建与优化触发器

Passons à la pratique !

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

Preparing Video For Download...