title: How to detect if a trigger is fired for an insert or update?
body: <p>I need to make a table in my database that has all of the history of all DML statements that occur in a given table. The <code>LOG</code> table is like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>id</th>
  <th>event</th>
  <th>ts</th>
  <th>record</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>update</td>
  <td>2020-01-01</td>
  <td>record1</td>
  </tr>
  <tr>
  <td>2</td>
  <td>delete</td>
  <td>2020-01-02</td>
  <td>record2</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>LOG table has a sequence for auto-incrementing the <code>ID</code> column and TS default is <code>NOW</code>.</p>
  <p>Do I need to create a sequence for every statement first or I can just create triggers for <code>AFTER</code> a DML statement is fired?</p>
  <pre><code>CREATE TRIGGER UPDATE
    ACTIVE AFTER INSERT OR UPDATE
    ON TableA
  AS
  BEGIN
    INSERT INTO LOG (event,record)
       SELECT record FROM TableA; # what I need to add here to set the event = UPDATE,INSERT or DELETE?
  END
  </code></pre>
  <p>Can I use something like this in my triggers with a statement to add an event values?</p>
  <p><strong>EDIT:</strong> This is the working solution thanks to @Mark Rotteveel and @Arioch'The:</p>
  <pre><code>CREATE TRIGGER INSERT_UPDATE FOR TableA
  ACTIVE AFTER INSERT OR UPDATE
  AS
  BEGIN
    IN AUTONOMOUS TRANSACTION DO
      INSERT INTO LOG(event,record)
          VALUES (CASE WHEN inserting THEN 'INSERTED' WHEN updating THEN 'UPDATED' END, new.record);
  END
  </code></pre>