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 »

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: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Table name as parameter

Post by Alex K. »

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 »

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: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Table name as parameter

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