MS SQL

Magic Table in SQL Server

INSERTED and DELETED are two types of magic tables in SQL Server.
An INSERTED magic table is populated with INSERT and UPDATE operations and DELETED magic table is populated with UPDATE and DELETE operations.

Below are the limitations of the magic table compare to the actual temp table (# table)

  1. Users can not create any index or apply any constraint on the magic tables in SQL Server
  2. They can not be altered because the purpose of the magic
    table is to audit the information in the system

A magic table is stored in the temp DB. Therefore, whenever you use the magic tables in SQL Server with the query statement, tempdb will come in the picture.

Leave a Reply

Prabhakaran Jayaraman