What are Inserted and Deleted Tables in SQL Server?

DML trigger statements use two special tables: the INSERTED and DELETED table. SQL Server automatically creates and manages these tables.Inserted and Deleted tables are temporary tables that are created by SQL Server in the context of a trigger. That means these two tables can only be available as part of a trigger. If you try to access these tables outside of a trigger, then you will get an error. The table structure of both inserted and deleted tables will be exactly the same as the table structure of the table on which the trigger is created.

Whenever you fire any insert, update, or delete statement on the table, all the new records are actually going to the inserted table i.e. all the updated and new records are present in the inserted table. On the other hand, all the old values are present in the deleted table.

For multiple DML operations being done in the trigger, these tables are affected in the following manner:

  • If any record is being inserted into the main table, a new entry, of the record being created, is also inserted into the INSERTED table.

  • If any record is being deleted from the main table, an entry of the record is being deleted, is inserted into the DELETED table.

  • If any record is being updated in the main table, an entry of that record (before it was updated), is added to the DELETED table and another entry of that record (after it was updated), is inserted into the INSERTED table.



INSERTED table, is a special table used by DML triggers. When you add a new row into tblEmployee table, a copy of the row will also be made into inserted table, which only a trigger can access. You cannot access this table outside the context of the trigger. The structure of the inserted table will be identical to the structure of tblEmployee table.


DELETED table, is a special table used by DML triggers. When you delete a row from tblEmployee table, a copy of the deleted row will be made available in DELETED table, which only a trigger can access. Just like INSERTED table, DELETED table cannot be accessed, outside the context of the trigger and, the structure of the DELETED table will be identical to the structure of tblEmployee table.


The After trigger for INSERT event, makes use of inserted table. 

The After trigger for DELETE event, makes use of deleted table. 

The After trigger for UPDATE event, makes use of both inserted and deleted tables. 

TriggerINSERTED or DELETED?
Instead of InsertDELETED table is always empty and the INSERTED table contains the newly inserted data.
Instead of DeleteINSERTED table is always empty and the DELETED table contains the rows deleted
Instead of UpdateDELETED table contains OLD data (before update), and inserted table contains NEW data(Updated data)