What are Magic Table?




Answers were Sorted based on User's Feedback



What are Magic Table?..

Answer / anand k

the magic tables are deleted and inserted.
while we are inserting or deleting a rows into a object the
magic tables were created and after the commit transaction
the tables are removed.so it is called magic tables

Is This Answer Correct ?    106 Yes 21 No

What are Magic Table?..

Answer / durga prasad.g

MAGIC TABLES NOTHING BUT INSERTED AND DELETED WHICH ARE
TEMPORARY OBJECTS CREATED BY SERVER INTERNALLY TO HOLD
RECENTLY INSERTED VALUES IN THE CASE OF INSERT,TO HOLD
RECENTLY DELETED VALUES IN THE CASE OF DELETE,TO HOLD
BEFORE UPDATING VALUES OR AFTER UPDATING VALUES IN THE CASE
OF UPDATE.

Is This Answer Correct ?    67 Yes 7 No

What are Magic Table?..

Answer / sivashankar.soma

The INSERTED and DELETED tables, popularly known as MAGIC
TABLES.

Is This Answer Correct ?    52 Yes 7 No




What are Magic Table?..

Answer / kar

The INSERTED and DELETED tables are the magic tables
anand ur right
roshan and shakila are totally wrong
prakash u r also wrong

Is This Answer Correct ?    50 Yes 9 No

What are Magic Table?..

Answer / sandeep yadav

INSERTED and DELETED tables known as MAGIC
TABLES.

Is This Answer Correct ?    42 Yes 6 No

What are Magic Table?..

Answer / subbu

suppose if we write a trigger on the table on insert or
delete or update

on insertion of record into that table,
inserted table will create automatically by database,

on deletion of record from that table,
deleted table will create automatically by database,

This two tables inserted and deleted are called magic
tables.

Is This Answer Correct ?    29 Yes 6 No

What are Magic Table?..

Answer / shailendra kashyap

Magic Tables:
Whenever a trigger fires in response to the
INSERT,DELETE,or UPDATE statement,two special tables are
created.These are the insert and the delete tables.They are
also referred to as the magic tables.These are the
conceptual tables and are similar in structure to the table
on which trigger is defined(the trigger table).
The inserted table contains a copy of all records that are
inserted in the trigger table.
The deleted table contains all records that have been
deleted from deleted from the trigger table.Whenever any
updation takes place,the trigger uses both the inserted and
deleted tables

Is This Answer Correct ?    18 Yes 3 No

What are Magic Table?..

Answer / imran badrampalli

There are 2 Magic Tables in SQL server Inserted and Deleted.
These are mantained by SQL server for Internal processing
whenever an update, insert of delete occur on a table.
However, we can refere these tables in a Trigger.
Whenever an update table statement is fired SQL server
mantains the original row before updation in a deleted
table and New (updated )row in a Inserted Table.

Same is the case when an insert is fired Only Inserted
table is populated with inserted Row.
and when Delete table statement is fired Deleted table is
populated with the deleted row.

Is This Answer Correct ?    11 Yes 3 No

What are Magic Table?..

Answer / aastha pallav

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

Is This Answer Correct ?    9 Yes 1 No

What are Magic Table?..

Answer / yogesh

You all have answered what magic tables are. its correct :
there are two magic tables named inserted and deleted.

On Insertion :
whenever an insert takes place, the data goes into inserted
table before the commit of the transaction.

On Deletion :
Whenever a row gets deleted from a table, data goes into
deleted table.

On Update :
Since an update statement is a combination of delete and
insert so in case of update data goes in both, inserted and
deleted tables.

But the further Question is :

How the magic tables get created by ASE? Can any one give
the detailed and satisfactory answer?

Is This Answer Correct ?    7 Yes 1 No

Post New Answer



More SQL Server Interview Questions

How to create Clustered Primary Key to table?

2 Answers  


difference between select column name from table name where serviceid=2; and select max(column name) from table name where serviceid=2; IN ORACLE

3 Answers   Intel, Wipro,


What are primary keys and foreign keys?

3 Answers  


how many types of store procedre in sqlserver 2000?

2 Answers   ATI,


What is a Lock and let me know Different types of locks?

2 Answers  






hi friends please answer this question ASAP:- how to count the no. of employee in a each department or no. of employee in each location by using emp/dept table

7 Answers   Indecomm,


This question asked during interview, 2) At the end of each month, a new table is created for each bank that contains monthly metrics consolidated at the account level. The table naming convention is bankX_YYYYMM where X represents the numeric designation of the bank and YYYYMM indicates the 4 digit year and 2 digit month. The tables contain the following fields: name data type description account text account number registered boolean indicates whether the account is registered num_trans integer number of transactions made during the time period spend numeric(9,2) total spend during the time period a) Write a SQL query that will display the total number of transactions and total spend for "Bank1" during the 4th quarter of 2009. b) Write a SQL query that will display the total number of transactions and total spend at "Bank1" and "Bank2", broken out by registered vs. non-registered accounts, during January 2010 not sure what is correct answer and how to solve?

0 Answers   TCS,


What is a trigger?

7 Answers  


How to count the number of duplicate items in a table?

3 Answers  


how to copy only distinct data into another table which is not already exist in database?

2 Answers   Spectra,


CTE(common table expression)

1 Answers   Thomson Reuters,


what is Constraint? How many types of constraints in SQL ?

38 Answers   IBM, HCL, Wipro, NIIT,






Categories