In this case:
SELECT ROW_NUMBER() over(Partition By Year(OrderDate) order by OrderDate) as RowN,* FROM [Northwind].[dbo].[Orders] order by RowN
What you see, this gives you a line number that is divided by year, which means that each year has its own line number for climbing . To do this a little cleaerer in the results:
SELECT ROW_NUMBER() over(Partition By Year(OrderDate) order by OrderDate) as RowN,* FROM [Northwind].[dbo].[Orders] order by RowN, Year(OrderDate)
This means that every year, say, in 1997, it will have orders from 1 to n, ordered by the date of that year ... as it was the first order of 1997, the second order of 1997, etc.
source share