disable group of triggers

  • I need steps  to disable triggers starts with 'act' and enable group of triggers starts with ' lbb'

    I appreciate for your help

  • I assume you're using SQL 2005 because you said you want to disable the trigger. I'd just query the system tables... here's the first part (you can probably figure out the last part yourself):

    DECLARE @sql NVARCHAR ( 4000 )

    SET @sql = ''

    SELECT @sql = @sql + 'DISABLE TRIGGER [' + tr.name + '] ON [' + ta.name + ']

    GO

    '

    FROM dbo.sysobjects tr

    JOIN dbo.sysobjects ta

    ON tr.parent_obj = ta.id

    WHERE tr.xtype = 'tr'

    AND tr.name LIKE 'act%'

    -- PRINT(@sql)

    sp_executesql @sql

  • To enable or disable triggers in SQL Server 2000, use

    ALTER TABLE events DISABLE TRIGGER <trigger name>

    ALTER TABLE events ENABLE TRIGGER <trigger name>

    <trigger name> is the name of the trigger to process, or the keyword ALL

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply