Tuesday 20 april 2010 2 20 /04 /Apr /2010 13:21

Transact-SQL provides the following ranking functions:

-RANK
-NTILE
-DENSE_RANK
-ROW_NUMBER

Rank() - Applies to monotonically increasing number for each value in the set
Row_Number() - simply assigns sequential numbering to the records of a result-set or to the records within groups of a result-set
Rank() and Row_Number differ only if there are ties.
Dense_Rank() - Method the rank is increasing number for each value in the set.
NTILE(n)- Which splits the records into partition based on the Column in the Over() and assigns the Rank for the partition.

OVER clause is required in all the ranking functions and with that you specify the partitioning and ordering of records before the ranking functions are evaluated. If you don't specify it, you will get an error similar to "Incorrect syntax near 'ROW_NUMBER', expected 'OVER'."
ORDER BY clause is mandatory and if you don't specify it you will get an error similar to "The ranking function "ROW_NUMBER" must have an ORDER BY clause.". With this clause you specify a column or a set of columns which will be used to order the records within a result-set or within record groups/partitions of a result-set. Please note you can specify only those columns which are being made available by the FROM clause of the query.

Please find the below Image for the example:

sqlrank
Click to get full Image

By Balavardhan Reddy - Posted in: SQL Server2005 - Community: Share Worldwide
Write comment - See the 8 comments
Home

Comments

What a inspired blog!After reading your blog, I feel very exciting! Thanks for sharing so wonderful article with us. Wish you have happy everyday! Now, I will introduce you a good product, supra skylow Shoes, it's a cheap and comfortable shoes. If you want to make your everyday comfortable, you can enter into the <a href=" http://www.supras.cc/supra-skylow-12/"> supra skylow</a> website. Thank you for your visiting!

Comment number1 posted by supra skylowsupra skylow on 03/08/2010 at 05h28

At the forefoot and heel of cheap nike shoes, there is low profile zoom with air units for extra lightweight and support steady and flexible for every step at any time. So you can easily rotate all directions. And it means that you can play with more pleasant when you wear the air jordan 14 sneakers for sale. Hurry up for the cheap Jordan shoes with a big discount online.

Comment number2 posted by cheap nike shoes on 11/11/2010 at 16h44

so wonderful!

Comment number3 posted by Nike Dunks on 12/11/2010 at 01h10

There ae two things to aim at in life: first, to get what you want; and ,after that, to enjoy it , only the wisest of mankind achieve the sceond.Our nike shox shoes store online tell you one meaningful words.I hope you can like it.I wish the words can help you in you life.By Nike Shox

Comment number4 posted by Shox r4 on 07/04/2011 at 11h20

Trick and treachery are the practice if fools;they have not wit enough to be honest. Our nike shox shoes store online tell you one meaningful words.I hope you can like it.I wish the words can help you in you life.By shox r4

Comment number5 posted by Shox r4 on 08/04/2011 at 03h36

<p>Your blog looked very modern with no exception of our <a href="http://www.sneakersoffer.com/"> Air Jordan Shoes</a> Enjoin us!<br /><p>

Comment number6 posted by sneakersoffer on 15/04/2011 at 04h49

My pleasure...it's a great effort and one that will make people and the planet healthier!

Any plans to duplicated efforts in or around Hartford? There are lots of folks up there who would love more farmers markets up that way.

Comment number7 posted by MBT Womens Amali Shoes on 20/05/2011 at 11h30

Will tell my programming friends about this website, cheers :).

Comment number8 posted by Muay Thai on 14/01/2012 at 18h49

My Blog

Profile

  • Balavardhan Reddy
  • Balavardhan Reddy Narani
  • Male
  • Life ASP.Net SQL Server Good Quotes SSRS
  • Software Eng.. From India..

Categories

Random pictures

  • 4.jpg
  • 3.gif
  • 2.jpg
  • 2.gif
  • 5.jpg

Recent comments

Recommend

Links

Create your blog for free on over-blog.com - Contact - Terms of Service - Earn Royalties - Report abuse - Most commented articles