Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 10 Oct 2003 @ 15:11:03 GMT


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


Subj:   Re: CSUM function
 
From:   Dieter Noeth

Ferry, Craig wrote:

  INSERT INTO dss_tables.expense_current_tbl_TEST
SELECT
'S'||
trim(extract(year from '2003/10/10'))||
(CASE
WHEN extract(month from '2003/10/10') < 10
THEN '0'||trim(extract(month from '2003/10/10'))
ELSE trim(extract(month from '2003/10/10'))
END)||
(CASE
WHEN extract(day from '2003/10/10') < 10
THEN '0'||trim(extract(day from '2003/10/10'))
ELSE trim(extract(day from '2003/10/10'))
END)||
trim(csum(1,d.date_invoice))
 



Can't help you with the ' ***' problem, but why do you use that complex calculation to retrieve the date string instead of a simple FORMAT?

select
'S'
|| trim(extract(year from '2003/10/10'))
|| (extract(month from '2003/08/10') (format '99'))
|| (extract(day from '2003/08/10') (format '99'))

,'S'
|| (extract(year from '2003/10/10') (format '9999'))
|| (extract(month from '2003/10/10') (format '99'))
|| (extract(day from '2003/10/10') (format '99'))

, 'S'
|| (cast ('2003/10/10' as date) (format 'yyyymmdd'))

And as you pass the date as a string, can't you simply use a properly formatted string?

sel 'S' || '20031010';


Dieter



     
  <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