regarding Triggers And BulkInsert & BulkCopy

  • dear all,

    when an Insert Trigger is set for a Table and then if Bulk Insert or Bulk Copy is run will the trigger(for that table) get fired?

    thanks & regards,

    Rajiv

  • Not unless you specify the FIRE_TRIGGERS hint which also causes the operation to become fully logged.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • hey jeff

    thanx for ur help.what do u mean by "logged"?

    i practically understood that trigger does not get fired when bulk insert is run.

    regards

    Rajiv.

  • Like I said, you have to give the hint "FIRE_TRIGGERS" to get triggers to fire during a bulk-copy or bulk-insert.  If you do that, then the inserts get "logged" in the log file as with any other insert.  One of the advantages of bulk-copy and bulk-insert is the speed they have because they can be made as non-logged inserts by changing the "recovery model" or by setting "Select Into/Bulk Copy" to true... beats DTS for speed every time if you do it right...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

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

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