Showing posts with label what is magic table in sql. Show all posts
Showing posts with label what is magic table in sql. Show all posts

Thursday, July 21, 2016

Magic table in SQL Server

There are two types of Magic table in SQL Server:

Inserted
Deleted

Inserting into table (Inserted table):


When we insert anything in base table in database, a table is automatically created by the SQL server, it is called inserted, and this table contains current updated or inserted record. We can access the record of this table via triggers.

Updating Table (inserted or deleted table):


When we delete anything in base table in database, in spite of one, two tables are created one is called INSERTED and another is called DELETED. Deleted table contain current record after the deletion operation and Inserted table contain previous record .We can access via triggers.

Deleting (Deleted Table):



When we deleted anything in base table in Database, a table is created by SQL Server called deleted table, this table contain current updated record after deletion operation. We can access this record via triggers.


                                               Author : Sachin Pathak