Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB2 Equivalent of IGNORE_DUP_KEY

Status
Not open for further replies.

Rohit K Gupta

IS-IT--Management
Oct 14, 2020
1
AU
Hi,

I have 3 Databases ion Oracle, SQL Server and DB2.

Source DB: Oracle
Target DB: SQL Server / DB2

On a daily basis we have to migrate Data from Oracle to SQL Server and Oracle to DB2. In C# application we are making use of BCP.

In SQL Server, the table has an unique index with IGNORE_DUP_KEY. So if we have duplicate data then it is simply ignored and all other data is copied successfully.

However, in DB2 if there is duplicate data, then entire transaction is rolled back. Is there any SQL Server equivalent option in DB2 or something we can do via C# BCP (
I have come up with an alternative that is dump all the data from Oracle into a file and then use DB2 Import as it skips duplicate records and finished the transaction. This is ok, but not a great solution as we have to write something out of the box in the application only for DB2.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top