Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

dense_rank() Expand / Collapse
Author
Message
Posted Friday, January 11, 2013 4:43 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, February 19, 2016 5:21 AM
Points: 19, Visits: 178
Hello,

It is possible to use dense_rank() function such that rank to begin with a specified ID ?

Thank you.


G.
Post #1405903
Posted Friday, January 11, 2013 5:36 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 10:42 AM
Points: 14,469, Visits: 38,080
dense_rank, like all the windowing functions like row_number,ntile and rank all start with one, so just add your some number to it to get your starting number
select 
dense_rank() over (order by object_id) + 428600 As Val, *
from sys.columns



Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Post #1405936
Posted Friday, January 11, 2013 5:52 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, February 19, 2016 5:21 AM
Points: 19, Visits: 178
Tks.

G.
Post #1405949
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse