SQL Triggers and Stored Procedures
Trigger: A trigger is a stored procedure in database which automatically invokes whenever a special event in the database occurs. Trigger are nothing but logic, which execute before insert, update and delete. They help us to executes preprocessing logic. Types of Triggers: 1. AFTER Trigger : AFTER triggers are fired after the SQL server finishes execution of actions like insert, update and delete fired. Executes after the data modification. 2. INSTEAD OF Trigger : INSTEAD OF triggers are fired before the SQL server starts execution of actions like insert, update and delete gets fired. Executes prior to data modification. Creating Triggers : 1. Select New Trigger from table : 2. Create trigger : 2. Execute trigger : Stored Procedures : Stored Procedures is a block code which we can re-use. Stored procedures are pre-compiled, their syntax and plans are already checked, so it increases the performance. Inline SQL : Inline query ...