MS SQL Server Concepts and Programming Question:

What Are Triggers in MS SQL Server?

MS SQL Server Interview Question
MS SQL Server Interview Question

Answer:

A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server. A trigger is really an event handler. SQL Server allows users to create triggers (event handlers) for 3 types of events:

* DML Event - Occurs when a DML (Data Manipulation Language) statement: INSERT, UPDATE or DELETE, is executed.
* DDL Event - Occurs when a DDL (Data Definition Language) statement: CREATE, ALTER, or DROP, is executed.
* Logon Event - Occurs when a user logins to the Server.

There are 3 different types of triggers (event handlers) based on the types of events they are triggered by:

* DML Trigger - Executes in response to a DML event.
* DDL Trigger - Executes in response to a DDL event.
* Logon Trigger - Executes in response to a logon event.


Previous QuestionNext Question
How To Drop an Existing Schema in MS SQL Server?What Are the Basic Features of a Trigger in MS SQL Server?