Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hi,
I want to pass the table name dynamically to SQL query in thingworx version 8.5.5
Is it possible ?
Thanks,
Chahat
Solved! Go to Solution.
If you pass the parameter with <<param>> instead of [[param]] it should work. E.g.
select * from <<table_name>>
I am not sure if you will be able to pass the table name as an input to a SQL query service. But you can wrap different condition sql query service in a JS service using if/else. Like if the input is TableA, call the select * from TableA or else if it is TableB call the select * from TableB service. The Grid can handle dynamic data shape as well.
In JDBC passing the table name as an SQL parameter is not possible.
You can create your own stored procedure for which there are examples in stackoverflow, but it leaves you open to SQL injection - and you don't want that.
I would follow my colleague's suggestion
If you pass the parameter with <<param>> instead of [[param]] it should work. E.g.
select * from <<table_name>>
It works.
Thanks!