Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 29 Oct 2003 @ 21:24:57 GMT


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


Subj:   Re: CSUM function
 
From:   Bhanu Gouindu

i AGREE WITH Dieter.

The original complex logic was not necessary and a simple format would do the job.

Secondly casting the csum result to an integer would expand the scope of your seq. key to about 2billion+ numbers. If you want to still increase that limit you can use NUMERIC datatype for casting. An example is shown below for an INTEGER. I tested this with a 30 million table and i get valid values for all the 30 mill records.

SELECT
'S'||
trim(extract(year from '2003/09/10'))||
trim(extract(month from '2003/09/10') (format '99')) ||
trim(extract(day from '2003/09/10' ) (format '99')) ||
trim(cast(csum(1,) as INTEGER))
from DBNAME.TABLENAME
;

Teradata discourages Use of CSUM, which they maintain only for backward compatibility reasons. You can use SUM function which has become very powerful lately.

bye



     
  <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