Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 reg magic table

Author  Topic 

rammohan
Posting Yak Master

212 Posts

Posted - 2009-09-30 : 08:23:27
dear all,
can u pls explain me what is magic table and waht is the way to create it in sqqlserver2005?

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-30 : 08:27:07
quote:
Originally posted by rammohan

dear all,
can u pls explain me what is magic table and waht is the way to create it in sqqlserver2005?

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN




What is meant by magic table?
If you are referring to the tables inserted and deleted, you dont need to create them. They are created based on the structure of the tables in which triggers are defined

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

asgast
Posting Yak Master

149 Posts

Posted - 2009-09-30 : 08:31:44
You don't created them, they magically appear, after you do some stuff :) a ritual of inserting, updating or deleting data other rituals don't create this tables as far as I know.

They are also known as inserted and deleted, but only to people who don't believe in magic :) try reading about them in BOL.
You usually use these tables in triggers and OUTPUT

Go to Top of Page

rammohan
Posting Yak Master

212 Posts

Posted - 2009-09-30 : 08:33:41
thank u,

but i have a doubt at a point, if i want to insert a row in table first its entry will be saved in temtable in tempdb or in magictable or in original table?
if i am performing update what will be the situation?

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

Go to Top of Page

asgast
Posting Yak Master

149 Posts

Posted - 2009-09-30 : 08:41:22
when you insert a row in our insert trigger you have access to all the data you are trying to insert bu using inserted table

when deleting the data is in deleted table

when updating sql deletes the rows and then inserts new ones with updated data so during update you have your old data in deleted and new in inserted

http://msdn.microsoft.com/en-us/library/ms191300.aspx
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-30 : 08:43:26
quote:
Originally posted by rammohan

thank u,

but i have a doubt at a point, if i want to insert a row in table first its entry will be saved in temtable in tempdb or in magictable or in original table?
if i am performing update what will be the situation?

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN




Read about triggers in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rammohan
Posting Yak Master

212 Posts

Posted - 2009-09-30 : 08:49:58
thank u

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

Go to Top of Page
   

- Advertisement -