Thanks for your kind remark. And thanks again for responding to these questions.
You're welcome. I was hoping you wouldn't mind too much if I had your back when you might be on holidays somewhere. 🙂
I now have a few thought questions that I have not yet had time to investigate myself:
1. I wonder why it is that LAG performed better than LEAD on the gaps solution. Granted that it could be that I used a sub-optimal version of LEAD, but it didn't look like there could be too much done to it to improve it (but I may be wrong).
2. I haven't yet tried LAG vs. LEAD on a wide array of problems but the few that I have tried it on could be solved by either. I wonder if it is always the case that LAG and LEAD are equally applicable to any problem that can be solved by either.
3. If #2 is true, would LAG always perform better, or under what circumstances would LEAD outperform LAG?
Inquiring minds want to know.
My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]
My thought question: Have you ever been told that your query runs too fast?
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]