The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
building up dynamic SQL queries
rschilling
Member Posts: 1 Learner III
I am not certain how to do this, although my research into macros seems to indicate they're involved somehow.
I have a database table (MySQL) with some meta-data in it. Say, one column in the data is a table name:
select tbl_name from mymetadata;
That returns a list of table names that I want to feed into a SQL statement. So, for each item from tbl_name, I want to run:
select count(*) from %{tbl_name}
How do I do this?
Thanks in advance..
Richard Schilling
I have a database table (MySQL) with some meta-data in it. Say, one column in the data is a table name:
select tbl_name from mymetadata;
That returns a list of table names that I want to feed into a SQL statement. So, for each item from tbl_name, I want to run:
select count(*) from %{tbl_name}
How do I do this?
Thanks in advance..
Richard Schilling
0
Answers
you should iterate over the examples, extract a macro for the table name and use the [tt]Read Database[/tt] operator in the loop to read the tables. It should work like this... Hope that gives you a hint,
Tobias