Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: Thursday, September 4, 2014 4:02 AM
Points: 14, Visits: 151
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: Today @ 6:48 AM
Points: 12,915, Visits: 32,075
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

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1405936
Posted Friday, January 11, 2013 5:52 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, September 4, 2014 4:02 AM
Points: 14, Visits: 151
Tks.

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

Add to briefcase

Permissions Expand / Collapse