Table name as parameter

Stimulsoft Reports.PHP discussion
Post Reply
catalin
Posts: 23
Joined: Sat Jan 30, 2016 10:31 am

Table name as parameter

Post by catalin » Thu Jan 25, 2018 12:18 pm

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
Alex K.
Posts: 6476
Joined: Thu Jul 29, 2010 2:37 am

Re: Table name as parameter

Post by Alex K. » Fri Jan 26, 2018 10:21 am

Hello,

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

Thank you.
catalin
Posts: 23
Joined: Sat Jan 30, 2016 10:31 am

Re: Table name as parameter

Post by catalin » Tue Jan 30, 2018 7:58 am

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}
Alex K.
Posts: 6476
Joined: Thu Jul 29, 2010 2:37 am

Re: Table name as parameter

Post by Alex K. » Thu Feb 01, 2018 12:44 am

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.
Post Reply