Select statement with variable tables

Maviee

New Member
Hi there,

in fact I feel pretty stupid to ask such a question, but I can't figure out how to solve my problem. I want to execute a simple select statement as the following:

SELECT COUNT(*) INTO i FROM TableName.

So far no problem, if I always write an actual table name into the statement. But what I want is a loop around this statement for all tables in my DB, so I have to fill the Tablename from a variable (or systable field):

SELECT COUNT(*) INTO i FROM cTableVar.

So my question is, how can I generate a select sttatement, where my tablename gets filled by a variable?

Thanks in advance
Mav
 
Might be, but also might not be. DBAnalysis takes about 2-3 hours to finish, so if I can set up a method which is faster, I'd prefer that solution instead.
But to decide which way is faster I have to try the SQL way.
 
The only ways to do this with SQL are to write out all the possibilities ... which you could easily do with a program ... or to dynamically generate a .p containing the desired statement and then run it.

But, trust me, it won't be faster than dbanalysis.
 
Back
Top