日期:2014-05-18 浏览次数:20570 次
set datefirst 1 select date from( select dateadd(dd,number,'2011-01-01') date from master..spt_values where [type] = 'p' and number >= 0 and number < datediff(dd,'2011-01-01','2012-01-01') ) t where datepart(week,date) = 46
------解决方案--------------------
http://topic.csdn.net/u/20091031/15/29aa1b45-23ed-49cd-8aa6-f9297fe95b6e.html
参考#3
------解决方案--------------------
借助AcHerat
#2楼
set datefirst 1 select MIN(date) as firstdate,MAX(date) as lastdate from( select date from( select dateadd(dd,number,'2011-01-01') date from master..spt_values where [type] = 'p' and number >= 0 and number < datediff(dd,'2011-01-01','2012-01-01') ) t where datepart(week,date) = 46) a