Solved

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

Posted on 2012-03-14
4
251 Views
Last Modified: 2012-03-14
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.
0
Comment
Question by:itatahh
  • 3
4 Comments
 
LVL 15

Accepted Solution

by:
Anuj earned 500 total points
ID: 37720315
SSIS works on Bulk Insert, for bulk inserts triggers will not fire, you have to enable Fire trigger option in ssis package.
0
 

Author Comment

by:itatahh
ID: 37720637
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
 

Author Comment

by:itatahh
ID: 37720719
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
 

Author Closing Comment

by:itatahh
ID: 37720731
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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now