Archive for November, 2011

So Just HOW do I find SQL Triggers in my SalesLogix Database?

We have ALL been taught to NOT use SQL triggers in a SalesLogix database. However, this is not reality. SQL triggers can be very useful if properly designed and implemented.

For example, ExchangeLink (for Sage SalesLogix) implements and users SQL triggers. My favorite “BPM” tool – TaskCentre – has the capability of deploying/maintaining a TRUE SQL trigger to initiate a task/workflow operation.

So just how do you check a (SQL) SalesLogix database to see if you have any triggers? Well, here are a couple of methods:

Run the following SQL and it will show you the Trigger Name and the table(s)  :

SELECT name as TriggerName, OBJECT_NAME(parent_obj) as TableName
FROM sysobjects
Where type = ‘TR’
Order By TableName

However I think I would like to know the “status” of the trigger(s) (Enabled or Disabled) since it just might make a difference as to what I will do next. So how about this:

SELECT A1.name as TableName,
A2.name as TriggerName,
CASE OBJECTPROPERTY(A2.id,’ExecIsTriggerDisabled’)
WHEN 0 Then ‘Enabled’
Else ‘Disabled’
END as ‘Status’
FROM sysobjects A1, sysobjects A2
WHERE A1.id = A2.parent_obj
and A2.type = ‘TR’
and A2.xtype = ‘TR’
ORDER BY TableName, TriggerName

Now I not only get to see the Table Names and Trigger (names) but also the Status of the trigger(s)!

Advertisements

,

1 Comment