Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2012-03-14
4
Medium Priority
?
258 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 15

Accepted Solution

by:
Anuj earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

618 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