Row level error handling


  • Hi,

    We are migrating data from one database to another in the same server.

    We are doing it through stored procedure.

    We need to capture row level error such that if the insert command fails for a particular row from source table we have to capture that record and proceed with the other records.

    We have tried using try catch but how to do it for a particular erroneous row is baffling me.

    Please help.!

    Tuesday, October 29, 2013 2:14 PM

All replies

  • Hi,

    You haven't given us any details whether you are migrating SQL server or any other database engines.

    What version you are migrating it from? Provide more details about the OS and version.

    What is the error message you are getting when you are trying to migrate?



    Tuesday, October 29, 2013 11:13 PM
  • Hi

    We are migrating SQl server database from 2000 and 2008 to 2012 (Windows)

    We aren't receiving any errors.

    (for example : for a table) We have used while loops to update data across database tables  row by row (record by record).

    We want to capture errors generated while updating record by record . We would like to log the corrupted records and process information( like no of succesfull updates ..etc)  and proceed with the next successful records. Tried on various ways with Try.. catch unsuccessfully.

    Please let us know how to capture record level logs while inserting ?

    Wednesday, October 30, 2013 2:34 PM
  • Have you used upgrade advisor to check whether pre-requisite is met. This will throw errors if any SPs are code needs any change.

    Check the below link from BOL.

    • Edited by kccrga Wednesday, October 30, 2013 9:58 PM
    Wednesday, October 30, 2013 9:58 PM