T-SQL查询两个日期之间的休息日(周六周日)天数
SELECT COUNT(*) FROM MASTER..SPT_VALUES WHERE TYPE = 'P' AND DATEADD(DAY,NUMBER,'2014-03-13')<='2014-03-26' AND DATEPART(WEEKDAY,DATEADD(DAY,NUMBER,'2014-03-13')) IN (6,7)
SELECT COUNT(*) FROM MASTER..SPT_VALUES WHERE TYPE = 'P' AND DATEADD(DAY,NUMBER,'2014-03-13')<='2014-03-26' AND DATEPART(WEEKDAY,DATEADD(DAY,NUMBER,'2014-03-13')) IN (6,7)