Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Fri, 13 Dec 2013 @ 15:16:22 GMT

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

Subj:   Re: Conditional Update with CASE
From:   Dave Wellman


How about something like the following (I've assumed that your second UPDATE is actually trying to change isourceid and not sourceid as posted).

     Update SUBSCR
     Set isourceid = case
                 When isourceid = 0 and source like '%||Newsletter %' then 60
                 When isourceid = 0 and (source like '%||CustomerService %'
     or source like 'BrandSite %') then 65
                Else isourceid

If the table that you're updating is large and the number of rows that should NOT be changed is large then you should probably add a WHERE clause so that the only rows considered for this processing (i.e. the ones that get updated) are those where the value will actually change. If you don't then even if the value in the column doesn't actually change, th efact hat the row meets the WHERE clause will generate a TJ row.



Ward Analytics Ltd - Information in motion (www.ward-analytics.com)

  <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: 24 Jul 2020