Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Gold Super Contributor
Posts: 3,087
Registered: ‎03-19-2009

Handy Hint from theToolBoxX of rjlSystems..

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 ;-)   

--
RJ Ledger - rjledger@rjlSystems.net +1 603.369.3047 x101

".. Innovators in Mobility - Experts in Workflow Automation..."
http://www.rjlSystems.net - blog: www.rjlSystems.net/blog.html
Silver Contributor
Posts: 1,262
Registered: ‎04-08-2009

Re: Handy Hint from theToolBoxX of rjlSystems..

Great thanks for that.

 

Alexander