Luis Cazares (4/18/2013)
I wish I could help you, but I don't understand what you're trying to do.Please take a look at the article linked in my signature to obtain better help.
It makes sense if you see this thread too, Luis.
I don't see much point in following this potential solution until others have been considered first.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden