Type of Triggers in SQL Server
By: Daniel Farina
In this section we will see that there are different types of triggers depending on the type of the event that fires the trigger.
Types of Triggers
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 of the execution of an insert, update or delete statement.
DDL Triggers give us the possibility to execute code in response of 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 according to where they are scoped.
- 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.