[LGP] has an internal tracing mechanism that outputs data to Trace class using standard .net mechanism. To enable various tracing categories you have to switch one various TraceSwitches either at runtime or in config file.
But what if you want to execute the same select directly in Sql Server Management Studio perhaps? The reason might be your curiosity. More valid reason would be to check the generated sql statement as it might behave poorly of badly (or not at all) if it isn’t constructed properly. And finding why in a huge statement soon becomes picking a needle in haystack.
Find the solution in this article.