declare @start date,@end date; set @start=‘2010-01-01‘; set @end=‘2010-02-01‘; --获取时间段内日期列表 select [day]=dateadd(day, number - 1, @start) from master.dbo.spt_values where type=‘P‘ and number <= datediff(day, @start,@end) + 1 and number>0
2024-01-15 13:42:46
declare @start date,@end date; set @start=‘2010-01-01‘; set @end=‘2010-02-01‘; --获取时间段内日期列表 select [day]=dateadd(day, number - 1, @start) from master.dbo.spt_values where type=‘P‘ and number <= datediff(day, @start,@end) + 1 and number>0