Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 03 Mar 2005 @ 10:10:16 GMT


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


Subj:   Update/Insert (Upsert)
 
From:   kumar28

All,

I am trying to use Update/Insert (Upsert) in one of my query..... I get a message saying I cannot use select with Insert in Upsert statement. I have to use select statement with Insert as it goes against multiple tables.....

Is there a way to update/insert in the scenario given below. I will really appreciate any ideas resolving this.....

     update table1
     set
     table1.col1= table2.col1
     table1.col2 =table2.col1
     table1.col3 =table2.col3
     where
     table1.col1 = table2.col1
     and table1.col2 =table2.col1

     ELSE

     Insert into table1
     select
     case statement.......table2.col1,
     case statement.......table3.col2,
     case statement.......table3.col3
     from
     table3 Left outer join table2
     on table3.col1 =table2.col1
     where
     conditions.......

Thanks

Raj



     
  <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: 27 Dec 2016