Request for Assistance with master named SQL Query Parameters

HI,

I am currently working on a project that requires the extraction of data from various SQL tables using a master named query. The challenge I am facing involves dynamically changing the table name for each execution, along with passing parameters for the From date (FD) and To date (TD). However, I have encountered an error stating that the string has a maximum length of 128 characters Please find the attached photos for your information.

Could you please provide guidance on implementing this solution or suggest an alternative method that accommodates the dynamic nature of the table names and date parameters? Your expertise in this matter would be greatly appreciated.

Thank you for your time and assistance.


Best regards,
B.R.Reddy

First, that's not a SQL query, it is a SQL script. Vanilla JDBC doesn't support that, and support in specific JDBC drivers is spotty.

Value parameters can only be injected where the JDBC driver can parse the given SQL (not a string parameter containing SQL) to identify a valid place for a substitution value.

Please describe your the fundamental requirement you are trying to achieve--not the "requirement" to use a single named query. Sounds like an XY problem.

Please also post your SQL as actual text (not a screenshot, and never a photo), using this forum's "preformatted text" button, so we can cut and paste into our replies.

1 Like

@pturmel is correct and make sure you really need to do what you're trying to do. There may be a better or easier way to achieve your end goal. IF the only way to go about it is with a dynamic table name, you'll probably need to create a stored procedure in the database and call that procedure from Ignition.