Got a bit of a strange one that I can't seem to work out.
We have a vendor database ( so we have no control over the table structure, foreign keys, etc…) that's on SQL Server 2012 SP2. We have a large amount of data that's getting loaded daily via an SSIS package.
The SSIS package is inserting rows using an OLEDB Command that is simply executing a stored procedure
EXEC StoredProc @Param1, @Param2, @Param3, @Param4, @Param5
The simplified version of what this procedure does is as follows
INSERT INTO TableA (Col1, Col2)
VALUES(@Param1, @Param2)
SET @IdentA = SCOPE_IDENTITY()
INSERT INTO TableB (Col3, Col4)
VALUES(@IdentA, @Param3)
SET @IdentB = SCOPE_IDENTITY()
INSERT INTO TableC (Col5, Col6)
VALUES(@IdentB, @Param4)
SET @IdentC = SCOPE_IDENTITY()
INSERT INTO TableD (Col7, Col8, Col9, Col10)
VALUES(@IdentA,@IdentB,@IdentC,@Param5)
SET @IdentD = SCOPE_IDENTITY()
INSERT INTO TableE (Col11, Col12, Col13, Col14, Col15)
VALUES(@IdentA,@IdentC,@IdentD,@Param3,@Param5)
We have triggers on each of the tables involved to transfer newly inserted data across to another system.
What appears to be happening is that the triggers do not fire when the procedure is run from SSIS. Everything works as expected when running the procedure from SQL Management Studio.
Anyone got any thoughts on why this could be occurring, and how we can resolve the issue.
Cheers
Phil
Best Answer
I was not able to reproduce your error (although I only tested with one table in the mix).
An OLE DB Destination has the ability to disable trigger and other check constraints when it loads but the OLE DB Command does not provide a similar facility.
Set up
I created a simplistic table: a key, a value and an empty field that will be populated, via trigger, when the row is updated. I created a trigger that will update the empty field for the modified row. Finally, I created a stored procedure to handle actually performing the UPDATE statement.
My package is simplistic. A data flow with an OLE DB Source and an OLE DB Command.
My OLE DB Source uses the following query which just calculates the next value of Bar in the ASCII table and also brings in the original value. A will become B, B becomes C, C becomes D.
The OLE DB Command uses the following statement.
OLE DB Connection Managers require the use of the
?
as an zero ordinal based replacement system. Here I mapped columnFoo
to the parameter@Foo
andNewBar
to the parameter@bar
because I'd hate to be consistent in my casing...After execution, as expected I saw my dates populated with ~ 1 second delay between each row to commensurate with the row-by-row nature of the OLE DB Command.
Biml
If you'd like to confirm you're seeing the same behaviour on your system, you're in luck. Biml, the Business Intelligence Markup Language, is an XML dialect that can be fed into a translator to generate SSIS packages. It's pretty slick. All you need to do is download and install the free add-in BIDS Helper
GIVE IT A TRY!!!