BCP and Triggers

  • Does anyone know whether using BCP to import data will fire FOR INSERT triggers?




    Five Stones IT Consulting and Development

  • From BOL

     

    Trigger Execution

    All bulk copy operations (the BULK INSERT statement, bcp utility, and the bulk copy API) support a bulk copy hint, FIRE_TRIGGERS. If FIRE_TRIGGERS is specified on a bulk copy operation that is copying rows into a table, INSERT and INSTEAD OF triggers defined on the destination table are executed for all rows inserted by the bulk copy operation. By default, bulk copy operations do not execute triggers.

    These considerations apply to bulk copy operations that specify FIRE_TRIGGERS:

    • Bulk copy operations that would usually be minimally logged are fully logged.
    • Triggers are fired once for each batch in the bulk copy operation. The inserted table passed to the trigger contains all of the rows inserted by the batch. Specify FIRE_TRIGGERS only when bulk copying into a table with INSERT and INSTEAD OF triggers that support multiple row inserts.
    • No result sets generated by the insert triggers are returned to the client performing the bulk copy operation.
  • Thank-you!

    That's perfect.




    Five Stones IT Consulting and Development

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply