When trigger is enabled, no records will insert via a dtsx job.

I have a table and trigger that is a duplicate in the design of another table in a different database.

While the table in the other database successfully allows the records to be inserted, and completes the trigger instruction, the one I am having trouble with, does not.

First I ran the Script 'Create  To' for the table and then the trigger.  I then changed the database reference and ran each script.  Next I performed the same duplication , but re-pointing the variables and database target.

When I ran the SSIS job, it showed the correct number of reads from the source file, but ended up stating that 0 records were written.

When I disabled the trigger, and reran the SSIS job, it had 100% of the read records written to the table.

I have looked numerous times and have not seen a single reason why the trigger should not work.  I have rebuilt it dozens of times.
itatahhAsked:
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.

AnujSQL Server DBACommented:
SSIS works on Bulk Insert, for bulk inserts triggers will not fire, you have to enable Fire trigger option in ssis package.
0

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
itatahhAuthor Commented:
anujnb,

Good suggestion.  I have made the change to this but I am still having a problem.

When the trigger is disabled, the data inserts just fine.

When the trigger is enabled, I now do not get zero records written into the intended table (not the table that the trigger copies the record to), but instead, the SSIS package fails.

So, all of the data arrives at the OLEDB destination correctly when the trigger is disabled.  Previously, no data arrived when the trigger was enabled, but I received no error, when the trigger is enabled.  Now it not only does not deliver any data, but the SSIS package gives me an error.

Attached is the output message showing the error.

I will begin looking up the error, to determine what it means, but if you, or anyone else, happens to see what it is, I would appreciate it.

Thanks,
0
itatahhAuthor Commented:
anujnb,

Credit goes to you for reminding me about the FIRE_TRIGGERS.

It ends up that while I was working on getting the trigger to work, I made a change to the destination table that I had not made also to the table the trigger was going to copy data to, after doing some checks.

So, now that I have the one field thee same length on both tables, it is working.

Thanks,
0
itatahhAuthor Commented:
Oh the simple things we sometimes forget.  Thankfully, there are enough around, at experts-exchange, that can point out what we missed - and without making us feel bad.  

Thanks!  :-)
0
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.