Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 03 Nov 2011 @ 13:16:35 GMT


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


Subj:   Alternative for dayofweek function
 
From:   Anomy Anom

<-- Anonymously Posted: Wednesday, November 02, 2011 15:17 -->

Hi Folks,

How can I simulate a dayofweek functionality in Teradata without actually using the dayofweek ODBC function ?

I have an existing code that uses this function in the where clause and its not working since its an ODBC function. How can I replace the below logic :

     WHERE
     HSP_TRANSACTIONS.TX_POST_DATE >= case
     when TEMP_TBL.EXTRCT_WNDW = 'Last Full Month' then add_months(current_date,
     -1) - dayofmonth(current_date) +1
     when TEMP_TBL.EXTRCT_WNDW = 'Last Full Week' Then current_date -
     dayofweek(current_date) -6
     else CAST('2011-10-01' AS DATE FORMAT 'YYYY-MM-DD') end I can replace the
     dayofmonth(current_date) by extract (day from
     current_date) above.

However, is there any alternative approach to implement dayofweek function ?

Thanks.



     
  <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