Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Mon, 08 Feb 2010 @ 14:46:35 GMT

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

Subj:   Re: Error 2801 in an insert query using left outer join
From:   Victor Sokovin

Antony Kavin Bosco wrote:

  Now when I run this query, I get an error as "2801 Duplicate unique prime key error in T2"  

  Since the target table is empty, I am confused on how I could get a duplication error over there. Kindly help me out.  

What is the column order in T2? If it is just the same as for T1 (A,B,C,D), then you inserd T1.D to T2.A, T1.A to T2.B, etc. So, there could be a good reason for potential violation of UPI as T2.D is null in the query.

Try to list the columns explicitly (if that's what you intend, of course):

     > Insert into T2 (D,A,B,C)
     > Select T1.D,T1.A, T1.B, T1.C
     > From T1 Left outer joinT2
     > ON
     > T1.A=T2.A
     > T1.B=T2.B
     > T1.C=T2.C
     > Where T2.D is null;

Perhpas that's all there is. If not, report back, and we'll see what else can cause the problem.


  <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: 15 Jun 2023