29 September, 2011

Ranking function of MsSQL Server 2005

All ranking function of SQL Server 2005:-

ROW_NUMBER () OVER ([] )
Returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition.


RANK () OVER ([] )
Returns the rank of each row within the partition of a result set.


DENSE_RANK () OVER ([] )
Returns the rank of rows within the partition of a result set, without any gaps in the ranking.


NTILE (integer_expression) OVER ([] )
Distributes the rows in an ordered partition into a specified number of groups.



No comments:

Post a Comment