Last week I had to do something very similar where a comparison date was being stripped to 7 characters that I hadn't realised. I used the following to calculate the from and too dates :- DATEADD(MONTH, DATEDIFF(MONTH, 0, @DateCheck), 0) -- First of Month DATEADD(MONTH, 1 + DATEDIFF(MONTH, 0, @DateCheck), -1) -- End of Month
Can't you just have computed column on year + month and put a index on it?
Have you ever just tried that?
Last week I had to do something very similar where a comparison date was being stripped to 7 characters that I hadn't realised. I used the following to calculate the from and too dates :-
DATEADD(MONTH, DATEDIFF(MONTH, 0, @DateCheck), 0) -- First of Month
DATEADD(MONTH, 1 + DATEDIFF(MONTH, 0, @DateCheck), -1) -- End of Month
Weird video. It has two comments, but I can see neither.
Maybe they saw you first.