Hi Alan/Chris,
Sorry, I did not post my original query since I didn't want to post the orig code. But all those parts are needed for my case. I wrote something similar. But I think what I wrote doesn't make sense at all. So it will be hard to interpret all this..
I think I will try to write up some code which makes sense and also post the execution plan.
thank you very much for your time.