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 Administration (2000)
 indexed view update

Author  Topic 

rubs_65
Posting Yak Master

144 Posts

Posted - 2004-10-08 : 13:12:38
Hi,

If we have indexed view on a table and if we update or insert the table that affect 100 rows in a single batch..so this will fire trigger in background to update indexed view 100 times or only 1 time

Thanks
--Harvinder

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-10-08 : 13:21:05
A trigger fires once for each DML statement. So if you've got a delete trigger, and you run one delete statement (regardless of how many rows it affects), the trigger fires once. You'll find all rows affected by the trigger in the inserted and deleted trigger tables.

Tara
Go to Top of Page

rubs_65
Posting Yak Master

144 Posts

Posted - 2004-10-08 : 13:24:49
Tara,

This is more of a reference to indexed views. since sql server take care of it for us so i am wondering how sql server would have handle this in background?

Thanks
--Harvinder
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-10-08 : 13:47:17
Triggers work the same way regardless if it is for an indexed view. They fire once per DML statement. That means not once per row, but once per statement.

Tara
Go to Top of Page
   

- Advertisement -