'How to capture what DML statement has modified the data in the DML trigger?

I have created a DML trigger to capture the data for a table that needs to have track all the data modifications.

I am able to capture the SPID, Hostname, Appname and UserName along with the records changed.

Now, I wanted to capture the DML statement that made the modifications to the records.

For example, I can insert into the table using

  1. Normal Insert statement with values
  2. Insert into table using selecting the records
  3. Using a Merge statement

Similarly, we can have multiple ways to do the other DML operations also like Update and Delete.

I wanted to capture the statement that the user has executed to modify the records.

Is there a way I can get this functionality?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source