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:
NAME AS TRIGGER_NAME,
CASE OBJECTPROPERTY (ID, 'EXECISTRIGGERDISABLED')
WHEN 0 THEN 'ENABLED'
END AS STATUS
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 ;-)