Oct 27, 2015

What are magic tables?

Magic tables are logical tables which are managed internally by SQL Server. In every DML operations first data move into these tables. "INSERTED" and "DELETED" are tables names for magic table. We can't access these tables except in trigger.


Magic tables are used by mostly triggers in SQL Server. DML Language uses these table to store data tempararey.


Often we need to know about the data which is inserted/deleted by the triggers in database. With the insertion and deletion of data, tables named “INSERTED” and “DELETED” automatically gets created in SQL Server which contains modified/deleted data. These “INSERTED” and “DELETED” tables are called magic tables.

No comments:

Post a Comment