Sage SalesLogix
  • Contact Us
  • Sage North America
800-643-6400
Welcome Twitter Facebook LinkedIn
Community Home Blogs Share Ideas Search Request Access Resources
Reply
Gold Super Contributor
RJLedger
Posts: 2,234
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

".. Stay Focused..."
http://www.rjlSystems.net - blog: www.rjlSystems.net/blog.html
Please use plain text.
Bronze Elite Contributor
apfingstl
Posts: 899
Registered: 04-08-2009

Re: Handy Hint from theToolBoxX of rjlSystems..

Great thanks for that.

 

Alexander

Please use plain text.