vision59
SSCrazy
Points: 2601
More actions
July 18, 2006 at 3:46 pm
#118786
I need steps to disable triggers starts with 'act' and enable group of triggers starts with ' lbb'
I appreciate for your help
Aaron Ingold
SSCrazy Eights
Points: 9070
July 18, 2006 at 4:44 pm
#649986
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
vadba
SSChampion
Points: 11133
July 19, 2006 at 8:18 am
#650117
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