I have 3 nodes: Microsoft SQL Server Connection, Database Table Selector, Parameterized Database Query
First 2 nodes work fine and I am able to see the results. But Parameterized Database Query node throwing the folloing error:
ERROR Parameterized Database Query 0:2570 Execute failed: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ‘)’.
SQL Query in Parameterized Database Query node is: SELECT * FROM #table#
Any help would be really appreciated!!
What is the table name that the placeholder “#table#” is substituted for? Does it maybe contain invalid characters? Have you tried or could you try the query with another database system, e.g. a simple local SQLite database? The error seems to come from Microsoft’s SQL driver, not from KNIME itself.
the #table# was actually another big query. The query replacing #table# is working fine when executing with knime database reader node, but throwing error when using with parameterized database query as #table#. So I am using the actual big query directly in the parameterized database query and it is working. No #table# involved in the query.
@nithinth7 oh, I see. I am glad it works now. Can I close this topic then?
The workflow is working for me, after the change. But I still don’t know why it is throwing error when using #table# as a place holder for another query.
@nithinth7 You want the placeholder to be replaced by a subquery? Maybe KNIME wraps it in quotes and that’s why it complains when it encounters a strange “table name” with parantheses?
the node creates a query with the input query as subquery such as
SELECT * FROM (SELECT * FROM “inputTable”) as “table”.
Some databases such as Microsoft SQL Server do not support subqueries without a table alias. So if you change your statement to the default statement which uses a table alias e.g. SELECT * FROM #table# AS “table” it should execute fine.
Sorry I didn’t understand your answer completely. Could you please give me an example?
the “as t” is crucial since this table alias is required when using sub queries in MS SQL and #table# is replaced with the input query.
Thank you very much!! It solved the problem
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.