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.
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 soarRAMMOHAN |
|
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 soarRAMMOHAN
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 definedMadhivananFailing to plan is Planning to fail |
|
|
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 |
|
|
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 soarRAMMOHAN |
|
|
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 tablewhen deleting the data is in deleted tablewhen 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 insertedhttp://msdn.microsoft.com/en-us/library/ms191300.aspx |
|
|
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 soarRAMMOHAN
Read about triggers in sql server help fileMadhivananFailing to plan is Planning to fail |
|
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2009-09-30 : 08:49:58
|
thank uOne can never consent to creep,when one feels an impulse to soarRAMMOHAN |
|
|
|
|
|
|
|