The best way to do this is to build your SQL using a tJavaFlex. You can Java in this to give you everything you need to build a String. You would build it in this component and then output to a tFileOutputRaw component. This component's documentation is shown below....