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
 Site Related Forums
 Article Discussion
 I think its OVER on sql servre

Author  Topic 

ya3mro
Starting Member

37 Posts

Posted - 2006-05-18 : 06:56:04
Thanx Too mush for ur articlw but it seem to me that ur Solution of the Real System Problem can make a big problem that

every time a Row is added to the IntelLog the Trigger will be fired and this will make a load each time row added

for example if 500 rows is added in the same time

we will have A 500 Operation Over

So i want to understanf from u if what i said is right or i have a misunderstand

i hope for ur Reply on my Email
amr.badawy@egyptnetwork.com

http://english.islamway.com

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2006-05-18 : 11:52:50
I have no idea what you are talking about. Is there some article you are referring to?



-ec
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2006-05-18 : 15:47:44
Load? Do you mean transaction? Or INSERT?

Michael

<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>

Opinions expressed in this post are not necessarily those of TeleVox Software, inc. All information is provided "AS IS" with no warranties and confers no rights.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-05-18 : 16:23:18
If 500 rows are added to a table in one batch, then the trigger will only fire once. The inserted trigger table will contain 500 rows.

Tara Kizer
aka tduggan
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2006-05-19 : 21:10:17
quote:
Originally posted by tkizer

If 500 rows are added to a table in one batch, then the trigger will only fire once. The inserted trigger table will contain 500 rows.

Tara Kizer
aka tduggan



Tara,

Lets say I have a batch/dts job running middle of night on a daily basis and if it inserts / updates 10000 records. I have triggers for both update and insert on that table, what will happen in this scenario? Will the insert and update trigger will be fired only once each?

Thanks




Karunakaran
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-05-19 : 21:27:56
It will fire once for each INSERT statement issued, and once for each UPDATE statement issued.
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2006-05-19 : 21:42:36
quote:
Originally posted by robvolk

It will fire once for each INSERT statement issued, and once for each UPDATE statement issued.


quote:

Originally posted by tkizer


If 500 rows are added to a table in one batch, then the trigger will only fire once. The inserted trigger table will contain 500 rows.

Tara Kizer
aka tduggan


Thats 10000 trigger firing we are talking about? or I'm totally misunderstanding things here...

Say if the batch process inserts 8000 records and updates 2000 records....

Thanks

Karunakaran
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2006-05-19 : 23:15:03
If you use BCP or bulk insert the triggers are disabled by default.



-ec
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-05-20 : 09:19:52
It depends on how the dts package is created. For the insert it may fire the insert trigger for each insert or not at all (depends a lot on how the destination is defined and what properties you select). It's easy to test to see what is happening. It coud fire once for the whole batch insert but if you had coded it to do that I think you would know.


For the update the update trigget will fire once for each update statement - i.e. if you have a single update statement that affects all rows in the table then the update trigger will fire once (and the inserted/deleted tables will contain all rows in the table).

For the number of rows you are talking about this shouldn't be a problem if the triggers are coded efficiently.

Have a look at
http://www.nigelrivett.net/#Triggers


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -