Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 04 Jan 2008 @ 10:50:18 GMT


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


Subj:   Updating target table row multiple times
 
From:   Anomy Anom

<-- Anonymously Posted: Fri, 4 Jan 2008 10:44 -->

I need to accomplish the following via SQL / BTEQ code. Any help would be greatly appreciated.

Staging table on Teradata contains rows to be inserted / updated to target warehouse table. The action to be performed (i.e Insert or Update) is denoted by a flag (column) in the staging table (containing 'I' or 'U'). For Updates, the target table row has to be made history by updating the end date/time of the row to the 'start date / time minus one second' of the new row and the new row has to be inserted into the target table. All of this is straightforward to code, except that the staging table may contain multiple updates per row i.e. one target table row may have multiple updates performed against it, therefore staging table will have multiple update rows for that target table row! So order of update is important.

Thanks in advance for your help.



     
  <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