Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 09 Dec 2009 @ 16:59:07 GMT


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


Subj:   Re: Populate columns with row number
 
From:   Rob Paller

Row_Number() in Teradata is a window aggregate function. As such, you need to provide it a "window", so to speak.

     UPDATE database.table
     SET MyRowId = ROW_NUMBER() OVER (ORDER BY )
     ;

You could also partition by a set of fields as well if you want the Row_Number to restart after a group of fields values change:

     UPDATE database.table
     SET MyRowId = ROW_NUMBER() OVER (PARTITION BY  ORDER BY
     )
     ;

Hope this helps. There is more information available about using window aggregate functions in the Teradata Manuals.



     
  <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