Programming in MS SQL Server 2012

ENABLE Trigger



By default, all triggers are enable mode when they are creates in the user-defined database. ENABLE TRIGGER statement is used to enable exists disabled trigger in the particular user-defined database.

The following example describes to enable existed DML trigger object.

-- Example 138 --

 

USE EBusiness

GO

 

IF OBJECT_ID ('dbo.DMLProductTableTrigger ','TR') IS NOT NULL

    ENABLE TRIGGER dbo. DMLProductTableTrigger ON dbo.Product;

GO


Query Output Screen



The following example describes to enable existed DDL trigger object.

-- Example 139 --

 

USE EBusiness

GO

 

IF EXISTS (SELECT * FROM sys.triggers

    WHERE parent_class = 0 AND name = 'DDLControlTrigger')

    ENABLE TRIGGER DDLControlTrigger ON DATABASE;

GO


Query Output Screen



* * * * *


Email Your Comment To AUTHOR