Hi guys, thanks for the help. I figured it out (as in it doesn't error anymore).
However, it's now doing something really interesting. It picks up the first case every time.
-Edit- I figured it out... wayward date calculation. For anyone needing to reference it, here's the code that worked out.
where dti.employeename = @empName and PostingDate >=
Case when (DateName(weekday, @startDate) != 'Sunday' AND e.OfficeCode in ('S', 'K', 'L', 'R') AND e.WorkPlace = 'F') then
DATEADD(dd, DATEDIFF(dd,0, @startDate), -datepart(weekday, @startDate))
Else
DATEADD(dd, DATEDIFF(dd,0, @startDate), 0)
End
and PostingDate < DATEADD(dd, DATEDIFF(dd,0,@endDate), 1)
|