Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 09 Dec 2008 @ 19:28:28 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: ML Error 2801: Duplicate unique prime key
From:   Pararha, Shubhangi

The duplicate primary key error can be caused because of the following:

1. The file or the table from where you are loading records into the target table have more than 1 record with the same UPI (unique primary index.).

The duplicate primary key error is caused if you are trying to insert data into a table with a UPI which is already in the table.

To find the erroneous record:

     Sel * from source_tbl
       where UPI in (sel UPI from target_tbl)

You may have to delete this record from the source table or use an update statement to update the record in the target table, with the source record. You cannot have both the record as you table has a unique primary index.

If you are using loading from a file, use mload with insert and update statement and use the option:

'Do insert for missing update row'



  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020