SQL running serial generating tips

SQL running serial generating tips:

Traditionally developers and Database administrators used temporary tables and co-related sub-queries to generate calculated row numbers in a query. Now SQL Server 2005 provides a function, which replaces all of the additional resources we used to generate row numbers.

Returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition.


select ROW_NUMBER() OVER(ORDER BY CLM1),* from Table1


The ORDER BY clause determines the sequence in which the rows are assigned their unique
ROW_NUMBER within a specified partition.