Inserting data from staging table to main table.

  • i am trying to insert bulk data into main table from staging table in sql server 2012. if any error comes, this total activity is rollbacked. i dont want that to happen. i want to know the records where ever the problem persists, and the rest has to be inserted. please suggest.

  • Use SSIS instead. It is easier and faster.

    But, if in case you have to do it in SQL Server only. Then write an SP, validate all records in the staging table first on the basis of Data Type and size.

    Then, remove those error records from stage table.

    Finally, move all valid records to Main table.

    Rest. I don't think we can fetch error records while bulk insert.

    ____________________________________________________________

    AP
  • Thank you.. currently i am going by the second option. since this is routine procedure, i cant go to the SSIS..

    i am trying for any other alternative to avoid these checkings which will save execution time..

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

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