Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Create Table #Numbers (Num Integer Identity(0,1))
Declare @i Integer
Set @i = 0
While @i < 10000
Begin
insert Into #Numbers Default Values
Set @i = @i + 1
End
Declare @StartDate DateTime
Declare @EndDate DateTime
Set @StartDate = '2006-06-01'
Set @EndDate = '2006-07-01'
Select Num, DateName(weekday, Num+@StartDate),
@StartDate + Num,
Sum(case DateName(weekday, Num + @StartDate)
When 'Saturday' Then 1
When 'Sunday' Then 1
Else 0 End) As WeekendCount
From #Numbers
Where (Num + @StartDate) Between @StartDate And @EndDate
Group By Num
Select Sum(case DateName(weekday, Num + @StartDate)
When 'Saturday' Then 1
When 'Sunday' Then 1
Else 0 End) As WeekendCount
From #Numbers
Where (Num + @StartDate) Between @StartDate And @EndDate