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)
 Trigger Question / Help

Author  Topic 

skillile
Posting Yak Master

208 Posts

Posted - 2002-12-06 : 14:09:06
How exactly does a trigger fire. Example:

I have multiple rows being selected for insert. Will the trigger fire on each row or after the batch insert. If they do fire on each row could I use a technique to fire on the batch.

Using SQL 2K


App: I want to insert many rows to a staging table and then use a trigger on this table to wake up and move the data around.

Thanks

slow down to move faster...

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-12-06 : 14:28:30
An INSERT trigger fires once per INSERT statement, regardless of how many rows were INSERTed by that statement. If you INSERT 100 rows as 100 separate INSERT statements, the trigger will fire 100 times. It would be far more efficient to INSERT 100 rows in one operation, if possible; then the trigger would only fire once, and it would affect those 100 rows as a batch.

Go to Top of Page
   

- Advertisement -