Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by Revenant
»
RANK() returns consecutive integers
19 posts, Page 2 of 2
««
1
2
RANK() returns consecutive integers
Rate Topic
Display Mode
Topic Options
Author
Message
Revenant
Revenant
Posted Thursday, January 06, 2011 9:16 AM
Hall of Fame
Group: General Forum Members
Last Login: Today @ 10:31 AM
Points: 3,454,
Visits: 2,529
cengland0 (1/6/2011)
There are several ranking functions:
. . . One row is still a non empty rowset but that was not explained in the provided explanation.
You are absolutely right. Thank you for pointing out this boundary case.
In my defense, I am still doing better than SQLS BOL which are not mentioning an empty set.
Post #1043838
UMG Developer
UMG Developer
Posted Thursday, January 06, 2011 10:49 AM
SSCrazy
Group: General Forum Members
Last Login: Monday, May 13, 2013 11:21 AM
Points: 2,163,
Visits: 2,148
Thanks for the question!
Post #1043890
SQLRNNR
SQLRNNR
Posted Thursday, January 06, 2011 11:33 AM
SSCoach
Group: General Forum Members
Last Login: Yesterday @ 1:07 PM
Points: 18,733,
Visits: 12,332
Thanks for the question.
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1043922
toddasd
toddasd
Posted Thursday, January 06, 2011 12:37 PM
SSC-Addicted
Group: General Forum Members
Last Login: Today @ 1:02 PM
Points: 477,
Visits: 3,652
Is it considered cheating that I went to the BOL before answering the question and read "If two or more rows tie for a rank, each tied rows receives the same rank."?
______________________________________________________________________________
How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.
Post #1043990
Koen Verbeeck
Koen Verbeeck
Posted Thursday, January 06, 2011 1:54 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 2:14 PM
Points: 9,370,
Visits: 6,468
toddasd (1/6/2011)
Is it considered cheating that I went to the BOL before answering the question and read "If two or more rows tie for a rank, each tied rows receives the same rank."?
I don't consider doing research and learning from it cheating.
I'm not going to memorize every feature, trace flag, syntax, dmv of SQL Server. If I need something, I'll look it up
How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
Member of
LinkedIn
. My blog at
LessThanDot
.
MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1044020
Carlo Romagnano
Carlo Romagnano
Posted Friday, January 07, 2011 1:26 AM
SSCommitted
Group: General Forum Members
Last Login: Today @ 12:54 AM
Points: 1,969,
Visits: 1,820
Koen (da-zero) (1/6/2011)
toddasd (1/6/2011)
Is it considered cheating that I went to the BOL before answering the question and read "If two or more rows tie for a rank, each tied rows receives the same rank."?
I don't consider doing research and learning from it cheating.
I'm not going to memorize every feature, trace flag, syntax, dmv of SQL Server. If I need something, I'll look it up
I agree! It's impossible to remember details of every command of every language.
Post #1044210
WayneS
WayneS
Posted Friday, January 07, 2011 4:30 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 8:49 AM
Points: 6,367,
Visits: 8,229
toddasd (1/6/2011)
Is it considered cheating that I went to the BOL before answering the question and read "If two or more rows tie for a rank, each tied rows receives the same rank."?
"Cheating" implies that this is a test - which it isn't. QotD is designed to do just this - get you looking into areas of SQL that you might not have been aware of. If you researched something, and learned from it, then mission accomplished.
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1044292
Dhruvesh Shah
Dhruvesh Shah
Posted Tuesday, January 18, 2011 6:03 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Wednesday, July 25, 2012 9:04 PM
Points: 542,
Visits: 187
I knew that Rank() skips the number if there is a tie but thought it's still consecutive number in a sense next available int number.
Post #1049261
zymos
zymos
Posted Friday, March 02, 2012 3:47 PM
SSC-Addicted
Group: General Forum Members
Last Login: Yesterday @ 9:43 AM
Points: 469,
Visits: 193
The RANK Function is a pretty interesting topic and a great pick. Below is an great example too using the AdventureWorks200R2 database.
URL: http://msdn.microsoft.com/en-us/library/ms189798.aspx
Thank you for the question.
Post #1261073
« Prev Topic
|
Next Topic »
19 posts, Page 2 of 2
««
1
2
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.