10-12-2009 12:57 PM
When it comes to SalesLogix (SQL) databases it's always handy to know IF there are ANY triggers on your tables and the status (Enabled/Disabled) of those triggers.
Here's a chunk of SQL that I ran across the other day that does this very nicely:
SELECT
OBJECT_NAME(PARENT_OBJ) TABLE_NAME,
NAME AS TRIGGER_NAME,
CASE OBJECTPROPERTY (ID, 'EXECISTRIGGERDISABLED')
WHEN 0 THEN 'ENABLED'
ELSE 'DISABLED'
END AS STATUS
FROM SYSOBJECTS
WHERE XTYPE = 'TR'
Output will look something like:
TABLE_NAME TRIGGER_NAME STATUS
CONTACT Contact_Del ENABLED
TICKET Ticket_Del DISABLED
If you need to disable ALL triggers use:
EXEC sp_MSforeachtable @command1="ALTER TABLE ? DISABLE TRIGGER ALL"
Of course do not try any this w/the SalesLogix "provider" since it will fail ;-)
10-14-2009 07:34 AM
Great thanks for that.
Alexander