Tuesday, 9 July 2013

magic tables in sql server

   Hi ,
        In this article we will see magic table in details.

What is magic tables?

There are Inserted and Deleted logical tables in SQL Server.These tables are automatically created and managed
by SQL Server internally to hold recently inserted,deleted and updated values during DML operations
(Insert,Update,Delete) on a database table.

both inserted and deleted table called as magic tables.
Basically, logical tables are used by triggers.

A)Inserted logical Table::

The Inserted table holds the recently inserted or updated values means new data values.
Hence newly added and updated records are inserted into the Inserted table.

For example of Inserted logical Table .CLICK HERE

B)Deleted logical Table::

The Deleted table holds the recently deleted or updated values means old data values.
Hence old updated and deleted records are inserted into the Deleted table.

For example of Deleted logical Table . CLICK HERE

We could not create the logical tables or modify the data with in the logical tables.Except triggers,
When you use the OUTPUT clause in your query, logical tables are automatically created and managed
by SQL Server. OUTPUT clause also has access toInserted and Deleted logical tables just like triggers.

     I hope You got something useful in this article.I would like to have feedback from my blog readers.
Your valuable feedback, question, or comments about this article are always welcome.


Other Popular Posts ::

Column in comma separated strings
Pivot Unpivot data in sql server
Combine two or more column in one column in sql sever
rank fuctions in sql
Get month wise Number of working
Take Back up of table using select statement in sql server
Column data in comma seprated string
Delete duplicate records from table
Date function in sql server
Sql server::String with initial letter in uppercase.
Joins in Sql server
Dynamic Query in sql server
Basic About View
send sql table data via email using store procedure
How to use Store Procedure inside a store procedure
SET ANSI_NULLS in sql server
SET QUOTED_IDENTIFIER in sql
example of Cursor in sql server
basic of Cursor in sql.
delete duplicate records in sql server
select duplicate records in sql server
update duplicate records in sql server
comman table expression(CTE) in sql server
Split Funtions in sql server
Sql queries for sql server
Trigger on Update

1 comment:

8451831077