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
 SQL Server Development (2000)
 Life of Inserted table

Author  Topic 

JimJudge
Starting Member

7 Posts

Posted - 2003-07-02 : 10:15:39
Does anyone know what the life of an Inserted table (associated with a trigger) is?

I am working on an app that receives data from equipment around the world via a pager system and WCTP. The our server's listener module will INSERT received messages in a table 'dvcMessage'. These INSERTs will happen rapidly however each INSERT will insert a single message record. I need to process the message record data as it is received so I thought that writing a trigger to grab the data from the Inserted table then process it is the way to go. However this will only work if each time the 'dvcMessage' trigger fires a separate Inserted table is created. If new INSERTS simply add to an existing Inserted table I'll have to rethink the approach.

Thanks

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-07-02 : 10:19:54
The lifetime of the inserted and deleted "tables" (bear in mind they are just in-memory representations of tables) is the DML statement which caused the trigger to fire. So, each INSERT statement, regardless of the # of rows to be inserted, causes the trigger to fire once and hence causes the inserted and deleted tables to be created once.

The upshot is your initial assumption is correct.

Jonathan
{0}
Go to Top of Page
   

- Advertisement -