82.4k views
4 votes
Which of the following is an SQL trigger Microsoft SQL Server supports?

1) BEFORE
2) INSTEAD OF
3) AFTER
4) B and C only
5) A, B, and C

1 Answer

4 votes

Final answer:

Microsoft SQL Server supports INSTEAD OF and AFTER triggers but not BEFORE triggers. The correct answer is option 4, which includes both INSTEAD OF and AFTER triggers only.

Step-by-step explanation:

The SQL trigger that Microsoft SQL Server supports are INSTEAD OF and AFTER triggers. SQL Server does not support BEFORE triggers, which are common in some other database management systems like Oracle and PostgreSQL. Therefore, when dealing with SQL Server, triggers that can be defined are those that take action either after the triggering event occurs (AFTER triggers), or in place of the triggering event (INSTEAD OF triggers).

An AFTER trigger runs after the data is inserted, updated, or deleted. This type of trigger is mostly used for auditing changes in tables. On the other hand, an INSTEAD OF trigger takes the place of the intended action (insert, update, or delete) and is primarily used for views, which cannot have AFTER triggers.

So, in response to the original question, the correct option would be 4) B and C only, corresponding to INSTEAD OF and AFTER triggers as the supported triggers in Microsoft SQL Server.

User Siran
by
7.6k points