Why does my trigger fire on Update but not on Insert?

Can you guys suggest why my trigger only works for mass update but not for mass insert?
CREATE TRIGGER [dbo].[ExampleTrigger] 
   ON  [dbo].[ExampleTable] 
   AFTER INSERT, UPDATE
AS 
BEGIN
	SET NOCOUNT ON;
	UPDATE ExampleTable SET ExampleTable.ExampleField= 1
	FROM ExampleTable S INNER JOIN Inserted I 
        ON S.ExampleID = I.ExampleID
END

Open in new window

I realise the code is a bit redundant by virtue of setting 1 to ExampleField... in my real world scenario this is a function derived value.
Reagrds,
dgloverukAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott PletcherSenior DBACommented:
No, the trigger looks OK to me, for either INSERTs or UPDATEs.
dgloverukAuthor Commented:
Hi Scott,
I've examined this more closely and indeed it does work when I insert a record.
Something I didn't mention was that prior to this single record insert test I was bulk inserting data using SSIS integration using identity insert... I am presuming something about this doesn't cause triggers to fire?
Regards,
Scott PletcherSenior DBACommented:
Yes, the "don't fire triggers" flag was probably on.

I never allow that flag on, so that the triggers always fire (except on very big loads where I must reduce the slight overhead of calling the trigger).  Instead I use CONTEXT_INFO to control triggers.  But that's just my preference.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dgloverukAuthor Commented:
Problem was definitely linked to the SSIS, couldn't see a don't fire triggers flag to set mind, I have worked around it anyhow.
Thanks Scott!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.