Home > Forum > Rules, JS, SQL > Show different Tables from SQL Server

Show different Tables from SQL Server
0

Hi there, Is it possible to use one datatable to show different tables from a sql server?
Right its possible to filter the sql results based on a value in a certain column. I also want to make it possible to show the content of a different table, however account to the infobox to the right side of the textbox where i write the sql statment, its not possible. So i was wondering if there is an alternative. It would be a grueling task to create a datatable for every table on the server(there are more than 40 i think).

Thanks in advance.

Hi,
it depends ;)
if queries to different tables can return the same column names (using aliases) then YES.
Just do UNION ALL and in WHERE give conditions specifying which tables are to be displayed.

e.g.
SELECT col1 as name, col2 as age FROM Table1 WHERE condition1
UNION ALL
SELECT col3 as name, col4 as age FROM Table2 WHERE condition2

MVP

Hi Almin,

What I understand is that you want to create a process with one field in which you can define an SQL statement and the data table should show the result.

If this is correct, than it will work if you predefine the name and number of columns.
We need to configure the data table using those columns and every query would need to return those columns. This could be either the actual value of a column or a dummy value.
You could define a simple statement like select 1 as id and configure the data table. Afterwards you can comment this row and insert the form field without single quotes. This way you should be able to configure dynamic sql statements. Of course there will be errors when the field does not contain any or an invalid statement.

I‘m guessing that you don’t have access to the SQL server. One alternative would be to use the „show logs“ option from the administration tools in the Designer Studio. You are not restricted to the logs table.

Another alternative would be to configure data sources.
I‘ve used both options in the past.

Best regards,
Daniel

In reply to: Daniel Krüger (Cosmo Consult)

Hi Almin,

What I understand is that you want to create a process with one field in which you can define an SQL statement and the data table should show the result.

If this is correct, than it will work if you predefine the name and number of columns.
We need to configure the data table using those columns and every query would need to return those columns. This could be either the actual value of a column or a dummy value.
You could define a simple statement like select 1 as id and configure the data table. Afterwards you can comment this row and insert the form field without single quotes. This way you should be able to configure dynamic sql statements. Of course there will be errors when the field does not contain any or an invalid statement.

I‘m guessing that you don’t have access to the SQL server. One alternative would be to use the „show logs“ option from the administration tools in the Designer Studio. You are not restricted to the logs table.

Another alternative would be to configure data sources.
I‘ve used both options in the past.

Best regards,
Daniel

I do have access to the sql server.
One of these fields is just to filter certain results(the name of this column is pretty similiar in all other tables). What i want is a way to show different tables with different columns(count and name). Ideally a button which could reset the table and the configuration of it would be ideal.

In the worst case i would need to create 1 table for every table on the sql server. Is it possible to only display the table with the data corrosponding to the sql table?