Continuing a transaction after primary key violation error

前端 未结 4 1052
旧巷少年郎
旧巷少年郎 2020-11-30 07:56

I am doing a bulk insert of records into a database from a log file. Occasionally (~1 row out of every thousand) one of the rows violates the primary key and causes the tran

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-30 08:40

    Or you can use SSIS and have the failed rows take a differnt path than the successful ones.

    SInce you are usinga differnt database can you bulk insert the files to a staging table and then use SQL code to select only those records which do not have an exisitng id?

提交回复
热议问题