I have table called Table A and I have created a trigger that handles INSERTS, UPDATES, DELETES. Now in order to process my next steps, I want to know what DML action has taken place. How do I know whether an Update/Insert/Delete has taken place.
Your thoughts, feedback is much appreciated!
Inside the trigger, you have two special tables at your disposal:
INSERTEDandDELETED. If a row exists only in theINSERTEDtable, then an INSERT operation occurred. Likewise, if a row exists only in theDELETEDtable, then a DELETE operation occurred. If the row exists in both tables, then an UPDATE occurred and theINSERTEDtable holds the new values while theDELETEDtable holds the old values.INSERTed Rows:
DELETEd Rows:
UPDATEd Rows: