Page 1 of 1

Table name as parameter

Posted: Thu Jan 25, 2018 12:18 pm
by catalin
Hi,
It's possible to pass the table name as a parameter?
Something like this:
SELECT f1, f2, f3 FROM
@table_name
ORDER BY f1 DESC


Thanks,
Catalin

Re: Table name as parameter

Posted: Fri Jan 26, 2018 10:21 am
by Alex K.
Hello,

Please check the following sample:
https://www.stimulsoft.com/en/samples/p ... -sql-query

Thank you.

Re: Table name as parameter

Posted: Tue Jan 30, 2018 7:58 am
by catalin
Hi,
I checked the sample but I didn't saw the answer of my question. I need to pass the table name as a parameter.

Code: Select all

SELECT f1, f2, f3 FROM @table_name ORDER BY f1 DESC
or

Code: Select all

SELECT f1, f2, f3 FROM {table_name} ORDER BY f1 DESC
I try it in both ways but is not working.

Also the sample is wrong:

Code: Select all

SELECT id, name
WHERE id = {Variable1}
ORDER BY name {Variable2}

Re: Table name as parameter

Posted: Thu Feb 01, 2018 12:44 am
by Alex K.
Hello,

You can use the following query:
select * from {VariableTableName}
and set value for the variable before run report.

Also, please clarify which version are you use?

Thank you.