July 18, 2006 at 3:46 pm
I need steps to disable triggers starts with 'act' and enable group of triggers starts with ' lbb'
I appreciate for your help
July 18, 2006 at 4:44 pm
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 @sqlNVARCHAR ( 4000 )
SET @sql = ''
SELECT @sql = @sql + 'DISABLE TRIGGER [' + tr.name + '] ON [' + ta.name + ']
GO
'
FROM dbo.sysobjects tr
JOIN dbo.sysobjects ta
ONtr.parent_obj = ta.id
WHEREtr.xtype = 'tr'
ANDtr.name LIKE 'act%'
-- PRINT(@sql)
sp_executesql @sql
July 19, 2006 at 8:18 am
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 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply