Some alternatives here.
[font="Arial"]“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw[/font]
For fast, accurate and documented assistance in answering your questions, please read this article
Understanding and using APPLY, (I)[/url] and
(II)[/url] Paul White
Hidden RBAR: Triangular Joins[/url] /
The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden