Hi Aleksey:
>This happens because NODATAONLOAD uses data types from the first SELECT in the UNION. However, the UNION operation, when it is really executed, might change final data types and cause the error. To workaround this problem, try to swap SELECT statements in the UNION, the goal is to make the first SELECT to return the same data types as the UNION does.
Swapping the SELECTs about was the first thing I tried but, no joy, unfortunately. However, it is good to know that "NODATAONLOAD uses data types from the first SELECT in the UNION" for definate. Maybe I can now look at this again (with some refactoring) in the event that the final query does change something that could otherwise be manipulated to provide a more compatible and predictable result.
Thanks for this advice. It is very much appreciated.
-=Gary