Subject | RE: [firebird-support] What programming languages and toolkits do you use to access Firebird? |
---|---|
Author | Mercea Paul |
Post date | 2008-09-30T18:48:32Z |
bartsmissaert@... wrote:
CREATE TABLE TABLESROWS (
TABLE_NAME VARCHAR(31),
TABLE_ROWS INTEGER
);
and make triggers on interested table like:
SET TERM ^ ;
CREATE OR ALTER TRIGGER mytable_COUNTROWS FOR mytable
ACTIVE AFTER INSERT POSITION 0
AS
begin
if (not exists(select 1 from tablesrows t where t.table_name='mytable')
then
insert into tablesrows (table_name, table_rows) values ('mytable',1);
update tablesrows set table_rows = (select count(id) from mytable);
end
^
SET TERM ; ^
Regards,
Paul
> Thanks, will try that.You can achieve this:
> I don't need the exactl number; only a rough
> estimate of the total rows in a table.
CREATE TABLE TABLESROWS (
TABLE_NAME VARCHAR(31),
TABLE_ROWS INTEGER
);
and make triggers on interested table like:
SET TERM ^ ;
CREATE OR ALTER TRIGGER mytable_COUNTROWS FOR mytable
ACTIVE AFTER INSERT POSITION 0
AS
begin
if (not exists(select 1 from tablesrows t where t.table_name='mytable')
then
insert into tablesrows (table_name, table_rows) values ('mytable',1);
update tablesrows set table_rows = (select count(id) from mytable);
end
^
SET TERM ; ^
Regards,
Paul