It looks like you are trying to prepare a SQL query which is used to return data based on a date comparison. If that is the case, you need to think about the following. Dates are not necessarily converted and formatted as Strings in the correct format for a SQL query. So you will need to use the routines.TalendDate methods to format your date in the correct format to be used in your query. The next thing to think about is that you will need to test this query. The best thing to do here is to test your query using a query analyser tool. I see you are printing your Query to the output, so I assume this is what you are trying.