Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Enabling a Trigger in Microsoft SQL Server Management Studio

By enabling triggers that track changes are turned on or off for these tables. Most of these tables have a delete trigger with a name in the format of  ‘XXXX_D_CDC’ where XXXX is the table name and an insert/update trigger in the form of ‘XXXX_IU_CDC’. Two tables make an exception to this rule and have 3 triggers, one for Insert, one for update and one for delete. They are tables SV00300 and SV00301.

...

  1. Launch Microsoft SQL Server Management Studio.
  2. Expand Databases > your company database > Tables.
  3. Expand the appropriate table.
  4. Expand Triggers.
  5. Right-click on the XXXX_D_CDC trigger and select Enable. (This is the "delete" trigger.)
  6. Right-click on the XXXX_IU_CDC trigger and select Enable. (This is the "insert/update" trigger.)


Enabled Triggers Script

This script provides a list of all enabled scripts for a given company:

SELECT sysobjects.name AS trigger_name, OBJECT_NAME(parent_obj) AS table_name,

             OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') AS [disabled]

FROM sysobjects

WHERE sysobjects.type = 'TR' AND sysobjects.name LIKE '%_CDC'

       and OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') = 0

ORDER BY disabled,sysobjects.name ASC

Enabled Triggers Query Results

These are the results of the enabled triggers script query, assuming all nine triggers are enabled:

Trigger Name

Table Name

Disabled

JC00102_D_CDC

JC00102

0

JC00102_IU_CDC

JC00102

0

JC00701_D_CDC

JC00701

0

JC00701_IU_CDC

JC00701

0

RM00101_D_CDC

RM00101

0

RM00101_IU_CDC

RM00101

0

SV00115_D_CDC

SV00115

0

SV00115_IU_CDC

SV00115

0

sv00196_D_CDC

sv00196

0

sv00196_IU_CDC

sv00196

0

SV00200_D_CDC

SV00200

0

SV00200_IU_CDC

SV00200

0

SV00300_D_CDC

SV00300

0

SV00300_I_CDC

SV00300

0

SV00300_U_CDC

SV00300

0

SV00301_D_CDC

SV00301

0

SV00301_I_CDC

SV00301

0

SV00301_U_CDC

SV00301

0

SV00400_D_CDC

SV00400

0

SV00400_IU_CDC

SV00400

0

Disabled Triggers Script

If you need to enable triggers for a table not found in this list, run the following script to find the triggers for a given table not in the list and then go through Microsoft SQL Server Management Studio and manually enable the trigger:

SELECT sysobjects.name AS trigger_name, OBJECT_NAME(parent_obj) AS table_name,

             OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') AS [disabled]

FROM sysobjects

WHERE sysobjects.type = 'TR' AND (sysobjects.name LIKE '%_D_CDC' or sysobjects.name LIKE '%_IU_CDC')

       and OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') = 1

ORDER BY disabled,sysobjects.name ASC

Disabled Triggers Query Results

These are the query results from the disabled triggers script, assuming the default nine triggers have been enabled:

...