Overview
In this section, we will discuss the different types of triggers depending on the type of event that fires the trigger.
Explanation
SQL Server has three types of triggers:
- DML (Data Manipulation Language) Triggers
- DDL (Data Definition Language) Triggers
- Logon Triggers
DML Triggers allow us to execute code in response to data modification. In other words, they allow us to run additional code in response to the execution of an insert, update, or delete statement.
DDL Triggers give us the possibility to execute code in response to changes in the structure of a database, like dropping or creating a table, or a server event, like when someone logs in. DDL Triggers can be split into two different types based on scope:
- Database Scoped DDL Triggers
- Server Scoped DDL Triggers
Logon Triggers are a particular case of Server Scoped DDL triggers that fire in response to the LOGON event that’s raised when a user’s session is being established.
Additional Information