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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

import (mload/bteq) with duplicate keys)

Status
Not open for further replies.

lexa001

Programmer
Oct 26, 2006
1
FR
Hello,

Is it possible to import records if they have duplicate keys ?
For example a file with 100 000 records in which one record exists in the table ; the result of the bteq or mload is "no record imported because of duplicate unique key" and I would like to import the 99999 records without modifying the file.

I thank you for your help on this.

B. regards

Xavier

 
You would be able to load this data if you define the target table with a non unique primary index.
 
Test the integrity of your data before inserting :

INSERT INTO doubles (id, columns, batch_no)
SELECT id, columns, $BATCHNO
FROM source
INNER JOIN
target
ON target.id = source.id
;
INSERT INTO target (id, columns)
SELECT id, columns
FROM source
WHERE NOT EXISTS ( SELECT 1 FROM doubles
WHERE doubles.id = source.id
AND doubles.batch_no = $BATCHNO
)
;

You can then use doubles table to update target table or whatever you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top