Why aren't my triggers firing during an insert by SSIS?

前端 未结 3 1842
抹茶落季
抹茶落季 2020-12-29 04:26

I have an SSIS data flow task with an OLE DB Destination component that inserts records into a table with a trigger. When I execute a normal INSERT statement a

相关标签:
3条回答
  • 2020-12-29 04:29

    You can do this without using SQL Server Data Tool for Visual Studio by editing the dtsx File with Notepad (or any other Text editors).

    Search for the following property:

    <property
     dataType="System.String"
     description="Specifies options to be used with fast load.  Applies only 
     if  fast load is turned on."
     name="FastLoadOptions">
          TABLOCK,CHECK_CONSTRAINTS
    </property>
    

    and add the value FIRE_TRIGGERS as Diego already described.

    0 讨论(0)
  • 2020-12-29 04:32

    complementing ladenedge's answer.

    Because the OLE DB Destination task uses a bulk insert, triggers are not fired by default

    that is true when you have the "fast load" option selected.

    enter image description here

    If you change it to a regular "table or view" data access mode, your triggers should fire normally because the insert is done row-by-row

    0 讨论(0)
  • 2020-12-29 04:37

    Because the OLE DB Destination task uses a bulk insert, triggers are not fired by default. From BULK INSERT (MSDN):

    If FIRE_TRIGGERS is not specified, no insert triggers execute.

    One must manually specify FIRE_TRIGGERS as part of the OLE DB component through its Advanced Editor.

    enter image description here

    Then add "FIRE_TRIGGERS" to the value of FastLoadOptions (note that options are comma-separated):

    enter image description here

    With that option in place, the triggers should fire during the task's execution.

    0 讨论(0)
提交回复
热议问题