Handle conversion between time zones in SQL Server - part 1
SET DATEFIRST 7; ;WITH cte(d,p) AS ( -- all the years from 2000 through 50 years after the current year: SELECT TOP (YEAR(GETDATE())-2000+51) DATEADD(YEAR,number,'20000101'), CASE WHEN number 7 THEN 1 ELSE 0 END -- year 2007 = 1, else ......