我想通过bind
绑定网格看起来像这样或sql查询看起来像
答案 0 :(得分:2)
DECLARE @startDate DATETIME
DECLARE @endDate DATETIME
SET @startDate = '2014-06-02'
SET @endDate = '2014-06-26'
;WITH dates AS
(
SELECT @startdate as Date,DATENAME(Dw,@startdate) As DayName
UNION ALL
SELECT DATEADD(d,1,[Date]),DATENAME(Dw,DATEADD(d,1,[Date])) as DayName
FROM dates
WHERE DATE < @enddate
)
SELECT Date,DayName frOM dates where DAYNAME in('Monday','Tuesday','Wednesday')