Subject | |
---|---|
Author | ben_ata |
Post date | 2004-02-21T00:00:38Z |
What I usually do, is create a SQL statement, that creates a SQL
script which in turn does what I want:
select 'SELECT cast('''||rtrim(rdb$relation_name)||''' as
varchar(100)), count(*) FROM '||rtrim(rdb$relation_name)||' UNION '
from rdb$relations
will create a SQL Statement that returns all table counts.
You only have to remove the last UNION keyword
If anybody knows if there is a different way to create a UNION with
one constant field, and a numeric field, other then casting the
constant to varchar() please let me know
SELECT 'table1', count(*) from table1
UNION
SELECT 'table2', count(*) from table2
does not work.
Regards
Thomas
script which in turn does what I want:
select 'SELECT cast('''||rtrim(rdb$relation_name)||''' as
varchar(100)), count(*) FROM '||rtrim(rdb$relation_name)||' UNION '
from rdb$relations
will create a SQL Statement that returns all table counts.
You only have to remove the last UNION keyword
If anybody knows if there is a different way to create a UNION with
one constant field, and a numeric field, other then casting the
constant to varchar() please let me know
SELECT 'table1', count(*) from table1
UNION
SELECT 'table2', count(*) from table2
does not work.
Regards
Thomas