Hi
I did not analyze the complete statement since now. BOL says the query is restricted to 8k.
Maybe stupid question: What if you just pot the code into a procedure on your remote server and call this procedure instead of this huge dynamic SQL statement?
Greets
Flo