How to run a query in Database Reader with a SQL Statement have over 8000 characters?

I need to read database with node named Database Reader, when the number of characters in the SQL statement is more than 8000, the console will report the error:
ERROR Database Reader 4:39 Execute failed: The character string that starts with 'select distinct serial_number,line,hour,
** substr(test_start_time,1,16)test_start_time,**
** items[‘Ansel_TDEV1_start’] Ansel_TDEV1_sta’ is too long. Maximum length is 8000.**
the following is the SQL statement:

the following is the workflow:

Thanks for your time!

1 Like

Openquery limits the number of characters in a query to 8000. So it is not specifically a KNIME Problem. Apparently there is a solution:

I don’t know how to set this up in KNIME though (anyone else?).
Another option “could” be just to try to get rid of whitespaces and line breaks in between comma separated items of your query. Maybe that would be enough to deflate the query in terms of size.
But i’m just guessing here. Let us know if anything worked out for you.


If follow the example SQL text needs to be placed in the variable.

1 Like


Thank you for the professional guidance to the limits of limits.The queried items from original data are combined with over 10000 other items.These items must be querying separately to ensure that there is not too much unnecessary data was read.


Is there any way to read databases in columns which maybe in the variable by loop?
If there is this method, the problem will be solved .

Any database node may accept parameters. Look at Database Looping it may be what you need.

Create a view in the database and query that view?

However I have a feeling if you need such a statement there is general something wrong with the approach.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.