Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 13 Dec 2013 @ 17:41:51 GMT


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


Subj:   Re: Conditional Update with CASE
 
From:   Anomy Anom

<-- Anonymously Posted: Friday, December 13, 2013 12:34 -->

You can use a CASE expression to determine the updated value:

     Set isourceid = CASE WHEN .... THEN 60 WHEN .... THEN 65 ... END

Note that you also need to include the WHEN conditions in the WHERE clause, to avoid updating all rows.

Or less efficiently, the CASE could have an "ELSE isourceid" to leave the value unchanged (even though the row is updated).



     
  <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