| || |
What are magic tables in SQL Server?
Posted On: 11-Jan-2018 07:26
Magic tables are the logical temporary tables created by SQL server internally to hold recently inserted values in the case of insert/update and to hold recently deleted values in the case of delete.
There are two types of Magic tables created at the time of insertion/updation/deletion in SQL server:
You can catch/feel these magic tables in the trigger and also you can access it in trigger. These magic tables are usefull for roll back in one transaction and also usefull for find out the old and new values in the DML commands.
In DML (Data Manupulattion Language) commnand we have following magical table accordigly
The 'INSERTED' magic table holds the new values of an insert/update operation.
In this example we will see how we can use magic tables in trigger
Suppose, create a table say 'Emp' with some records
Now create different triggers
Now we will do different DML operation and we will see the output
In the above blog we will understand the magic tables and their uses.
Active User (3)