上下合并??? 啥数据库?


--------
WITH B AS(
select '2013-01-01' [startDate],'2020-12-31' [endDate]
)
select convert(varchar(4),dateadd(YEAR,number,startDate),120) as [year]
from B , master..spt_values
where type='P' and number>=0
and dateadd(YEAR,number,startDate)<=endDate
