Error Handling

  • I am dealing with a table of nearly 20 million rows. the execution process flow is as a new column is updated which fires the trigger. this trigger inserts records into two different tables. Now i am updating the column on base table with 20 million rows in batches of 200,000 records.

    My question is what will happen if there is unsuccessful insert of the record? Will the whole process of update be rolled back or only the batch of 200,00 will throw an error and the loop for updating further records will keep on going?

    Is there any way to trap the insertion error and redirect it to error table? I know i can use TRY/CATCH but not sure how will it work in batch update.

  • I'd do explicit transactions and commit then you should be all set with the an error only rolling back the current transactions. You can do TRY CATCH in a batch.

    Jack Corbett
    Consultant - Straight Path Solutions
    Check out these links on how to get faster and more accurate answers:
    Forum Etiquette: How to post data/code on a forum to get the best help
    Need an Answer? Actually, No ... You Need a Question

  • Jack Corbett (1/5/2010)


    I'd do explicit transactions and commit then you should be all set with the an error only rolling back the current transactions. You can do TRY CATCH in a batch.

    Thanks Jack

    This thing came to my mind after i have posted the query here. I think that was the time to go to bed.

    Hopefully Coffee will keep me going for the whole day now 😛

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

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