Subject | RE: [firebird-support] Count records in tables |
---|---|
Author | Markus Ostenried |
Post date | 2004-02-20T15:32:42Z |
At 15:32 Friday, 20.02.2004 +0000, you wrote:
From: "Tanz Anthrox" <tanz_anthrox@...>
Date: Thu, 12 Feb 2004 15:40:30 +0200
Subject: Result: [firebird-support] SELECT COUNT(*) FROM :PARAMTABLE -
CREATE PROCEDURE SP_SERVERISTATISTIK
RETURNS (
TABLOAD VARCHAR (50),
KAYITSAYISI BIGINT)
AS
begin
for
SELECT RDB$RELATION_NAME
FROM RDB$RELATIONS
WHERE
(RDB$RELATION_NAME NOT LIKE 'RDB$%')
and
(RDB$VIEW_SOURCE IS NULL)
INTO
:TABLOAD
DO
BEGIN
execute statement 'SELECT CAST(COUNT(*) AS BIGINT) FROM ' || TABLOAD
INTO :KAYITSAYISI;
suspend;
END
end
HTH,
Markus
> > Loop through the RDB$_RELATIONS table and for eachthere is...
> > RDB$RELATION_NAME that has zero for the RDB$SYSTEM_FLAG
> > field, do a count on that table. You will probably have to do
> > this on the client side since you can't use variables for
> > table and field names in a query in stored procedures.
>
>Cheers - I had hoped there was an easier way via SP or script....
From: "Tanz Anthrox" <tanz_anthrox@...>
Date: Thu, 12 Feb 2004 15:40:30 +0200
Subject: Result: [firebird-support] SELECT COUNT(*) FROM :PARAMTABLE -
CREATE PROCEDURE SP_SERVERISTATISTIK
RETURNS (
TABLOAD VARCHAR (50),
KAYITSAYISI BIGINT)
AS
begin
for
SELECT RDB$RELATION_NAME
FROM RDB$RELATIONS
WHERE
(RDB$RELATION_NAME NOT LIKE 'RDB$%')
and
(RDB$VIEW_SOURCE IS NULL)
INTO
:TABLOAD
DO
BEGIN
execute statement 'SELECT CAST(COUNT(*) AS BIGINT) FROM ' || TABLOAD
INTO :KAYITSAYISI;
suspend;
END
end
HTH,
Markus