What are triggers? How to invoke a trigger on demand?


               Triggers are special kind of stored procedures that get executed automatically when an INSERT, UPDATE or DELETE operation takes place on a table. . It can be used to maintain referential integrity. A trigger can call stored procedure.



              Triggers can't be invoked on demand. They get triggered only when an associated action (INSERT, UPDATE, DELETE) happens on the table on which they are defined. Triggers can also be used to extend the referential integrity checks. You can specify which trigger fires first or fires last using sp_settriggerorder.


               Triggers are generally used to implement business rules, auditing. Triggers can also be used to extend the referential integrity checks, but wherever possible, use constraints for this purpose, instead of triggers, as constraints are much faster.