For training related to .net,OOPS,design patterns, MVC,WCF and .net fundamentals
contact at or Click Here

Click here for my training feedbacks


Follow Us

Share your Interview questions here

For software development queries contact

Follow by Email

Learn everything about MSBI

04 August 2010

Using Ranking Functions

  • Ranking functions return a ranking value for each row in a partition.
  • Depending on the function that is used, some rows might receive the same value as other rows.
  • Ranking functions are nondeterministic.
SQL Server 2005 has total of 4 ranking function.

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

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

Returns the rank of rows within the partition of a result set, without any gaps in the ranking.

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