Cannot use parameter in sql query

Hello Team,

I am unable to pass parameter in sql query in reporting

can anyone help with this issue.

Thanks,
Srushti

You cannot use ? substitutions for SQL structure (schema/table/column names, et cetera), only for values.

Hello @pturmel Thanks for you quick reply but I want to parameterize the column names from outside so is there any way to do it.

Set the parameter type to QueryString instead of Value. Be careful when you do this. You never want to expose these type of variables to the user because of SQL injection. However, you seem to be using the params for aliasing...not sure why that would be necessary.

Hello @dkhayes117 thank you for reply this parameter is different I want to do it using report parameters


this is the error when I tried this method

More context is needed...a query would be nice.

"select tstamp,[EM1] as {M1},[EM2] as {M2} from Sulphonation_KWH" this is the query in which M1 and M2 are parameters

Can you add a screenshot of your report/named query setup

Why not just use your report parameters directly where you want to display these columns, and drop the (again, highly insecure) query string parameters from your named query?

5 Likes