SQL Server 2008 with all the latest service packs and patches as of November, 2014.
See the following SQL Query:
SELECT ID AS tID, BillID, TransactionID, Amount AS ChargeAmount
WHERE (ClientID = @ClientID)
AND (Date BETWEEN @StartDate AND @EndDate)
AND DATEPART(weekday, Date) = @DayOfWeek
This query is used in a SSRS report where the user can choose Monday, Tuesday, Wed., and so forth to see data on only those days in a date range. Unfortunately, it's not working. The user doesn't work on Sunday at all yet there is all kinds of stuff on Sunday. Do I have the DATEPART in the WHERE CLAUSE correct? In the SSRS report, I have a parameter set up with:
Monday = 1
Tuesday = 2
Wednesday = 3
Thursday = 4
Friday = 5
Saturday = 6
Sunday = 7
So @DayOfWeek gets passed whatever number of the day the user chooses from the parameter.