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 2000 Forums
 Transact-SQL (2000)
 Magic Tables

Author  Topic 

vivek.kumargupta
Starting Member

45 Posts

Posted - 2005-06-03 : 18:44:05
Hi can anyone gimme info abt the inserted and the deleted tables (magic tables)used be SL to identify DML stmts.Any help will be appreciated.


Thanks,
Vivek

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-06-03 : 18:46:03
You can find information about them in SQL Server Books Online. Open it up, click the Index tab, type in CREATE TRIGGER, hit Enter, go to first title.

Not sure why you are are calling them magic tables. Nothing magical about them.

Tara
Go to Top of Page

vivek.kumargupta
Starting Member

45 Posts

Posted - 2005-06-03 : 18:51:46
Forget the Magical part of it ...ok its given in BOL but it doesnt explain the concept of inserted and deleted tables.Thats why I asked the team.Any help ?????

Thanks,
Vivek
Go to Top of Page

vivek.kumargupta
Starting Member

45 Posts

Posted - 2005-06-03 : 19:59:47
Ok I got the answer...
the inserted table is a temp table which is created after the insert stmt is fired.This pvt table has the same structure as the struct of the base tables and exists only for the duration of the trigger.It isolates the inserted records.
After the trigger ends its exec the inserted table is deleted and the record is marked as inserted.

Thanks,
Vivek
Go to Top of Page

vivek.kumargupta
Starting Member

45 Posts

Posted - 2005-06-03 : 20:01:29
Tara ,the reason I called these tables as Magical coz of their typical behaviour just explained abv.

Thanks,
Vivek
Go to Top of Page
   

- Advertisement -