Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Thu, 27 Dec 2001 @ 17:11:45 GMT

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

Subj:   Re: Sequences in Teradata?
From:   David Wellman


When you refer to 'sequencs' are you meaning sequence numbers? You can apply a unique number to each row in an answer set (i.e. result of a SELECT statement) using the CSUM function, e.g.;

>From .....

This will provide a unique, sequential value to each row in the answer set. 'Col1,col2' are used for sorting the rows such that the row with the lowest value of 'col1,col2' will have a sequence number of 1, the row with the next lowest value of 'col1,col2' will have a sequence number of 2 etc etc.

You can have multiple columns used to sort the rows (I'm not sure of the actual limit - probably 16). Even if two or more rows have the same sort key, using the CSUM function will assign them different values.

Obviously this function cannot be used as part of a fastload or multiload script, you'd need to use something like an access module or inmod for that.

Hope that helps,


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: 15 Jun 2023