摘要:
declare @dt datetimeset @dt = '2010-12-15';with t1 as( select dt = @dt-day(@dt)+number from master..spt_values a where type = 'P' and @dt-day(@dt)+number = dateadd(m,1,@dt)-day(@dt) and number0),t2 as( select wk = substring(datename(weekday,dt),3,1), ww = datepart(week,dt),dd = day(dt) from t1)sel 阅读全文