CREATE TRIGGER trInsertImplementationTaskP1
on dbo.ImplementationTasks
FOR INSERT
AS
DECLARE @.ITIDint
SELECT @.ITID = (SELECT ITid
from inserted)
EXEC TrigSendNewIMAlertP1 @.ITIDIf you insert 4 rows as part of a single insert statement, (INSERT INTO foo(id) SELECT ID FROM OtherTable) then the trigger will only be fired once. If you run 4 seperate insert statements, then the trigger will be called 4 times.|||I am using a datagrid with a checkbox per row... for example if the user check 4 out of 10 checkboxes then press submit, it will insert 4 new records. This should fire the trigger 4 times during the insert event correct?|||That depends how you implement the code. Use SQL Profiler to see how the commands are being sent, if you cannot figure out how it is implemented.|||
Hi,
I'm in a similar situation. I have to table and I insert records from TABLE_1 to TABLE_2 using INSERT TABLE_2 (ld_ID) FROM SELECT ID FROM TABLE_1 WHERE some criteria . I have a trigger that fires when a record is inserted to TABLE_2. I need this trigger to fire for each record inserted to the TABLE_2. How can i get this to work.
Many thanks.
-VJ
No comments:
Post a Comment