Howtos / Articles

Enable and Disable Triggers in Microsoft SQL Server

The Microsoft SQL database server supports the use of Triggers on its tables. Triggers are a special kind of stored procedure that can be executed when records in a table are either inserted, updated, or deleted.…

Read more [...]

Enable and Disable Triggers in Firebird

The Firebird database engine supports the use of Triggers on its tables. Triggers are basically a set of SQL scripts that can be executed when data in a table is either inserted, updated, or deleted. Sometimes you may want to temporarily disable a trigger without completely removing it. The steps to do this, and enable the trigger again, are outlined below. Disable Trigger: ALTER TRIGGER <trigger name> INACTIVE; Enable Trigger: ALTER TRIGGER <trigger name> ACTIVE; Replace <trigger name> with the…

Read more [...]

Set the order of SQL triggers

Microsoft SQL Server allows you to add multiple triggers on a specific table. This is a great feature of Microsoft SQL Server, however one of the issues that can catch people out is in the order that the triggers will ‘fire’. By default, the triggers will run in the order that they were created/added to the database (typically, but not guaranteed). SQL Server does provide a way to set the order of ‘AFTER’ triggers (to an extent), but it must…

Read more [...]

List all Triggers on a SQL Database

Ever wanted to know what triggers exist on a database? The script below will produce a list of all the triggers on the current database, and also what table they are linked to.   SELECT Name AS TriggerName, OBJECT_NAME(parent_object_id) AS TableName FROM sys.objects WHERE type=’TR’    …

Read more [...]