Dears, I'm trying to enter some commnets inside my huge queries. I'm using talend 5 and Microsoft SQL Server 2008 r2. The problem is, when i'm tesing those queries after writting the comments using this format, for example ---write comment select * from employees where ---write comment employee_id = 123
The query is executed successfully, but when it is executed in daily scheduled jobs. I got error java.sql.SQLException:Incorrect syntax near 'WHERE'.
My question is there any option i have to enable in talend component (tMSSQLINPUT), to enable comments from sql query. Thanks.
Hi, So far, there is no such option in components tMSSQLInput component. How about Calling a stored procedure or function so that the SQL query is written in Microsoft SQL Server 2008 r2. Best regards Sabrina
-- Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
The problem is that tMSSqlInput replaces the CR/LF that you enter in the Query with spaces because the Java code cannot have a String broken across lines. As a result, parts of your SQL get commented out incorrectly when passed to SQL Server. Instead use /** and **/ to delimit your comments i.e. "/** write comment **/ select * from employee where /** write comment **/ employee.id = 123" or force the line-feeds in i.e. "-- write comment\r select * from employee where -- write comment\r employee.id = 123"