Recursive search and horizontal appending

I think one approach might be to do this dynamically. My question to you though is what are you trying to solve, why is it that you have to do this? Are you doing some sort of data forensics? Also I believe you have asked this question in the past. Did the answers there not work for you?