Subject | Re: [ib-support] Unwanted Domains |
---|---|
Author | Lucas Franzen |
Post date | 2001-07-12T21:41:55Z |
Todd Brasseur schrieb:
To get a list of all unused domains you could do:
SELECT F.RDB$FIELD_NAME FROM RDB$FIELDS F
WHERE
F.RDB$SYSTEM_FLAG = '0'
AND F.RDB$FIELD_NAME NOT STARTING WITH 'RDB$'
AND NOT EXISTS (
SELECT RDB$FIELD_SOURCE FROM RDB$RELATION_FIELDS R
WHERE R.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME )
I tested on a database:
DELETE FROM RDB$FIELDS F
WHERE
F.RDB$SYSTEM_FLAG = '0'
AND F.RDB$FIELD_NAME NOT STARTING WITH 'RDB$'
AND NOT EXISTS (
SELECT RDB$FIELD_SOURCE FROM RDB$RELATION_FIELDS R
WHERE R.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME )
and all the unused domains were gone afterwards.
But I don't guarantee for any side-effects.
Regards
Luic.-
>Todd,
> Is there a quick way of getting rid of all domains in a database that
> aren't used by anything?
To get a list of all unused domains you could do:
SELECT F.RDB$FIELD_NAME FROM RDB$FIELDS F
WHERE
F.RDB$SYSTEM_FLAG = '0'
AND F.RDB$FIELD_NAME NOT STARTING WITH 'RDB$'
AND NOT EXISTS (
SELECT RDB$FIELD_SOURCE FROM RDB$RELATION_FIELDS R
WHERE R.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME )
I tested on a database:
DELETE FROM RDB$FIELDS F
WHERE
F.RDB$SYSTEM_FLAG = '0'
AND F.RDB$FIELD_NAME NOT STARTING WITH 'RDB$'
AND NOT EXISTS (
SELECT RDB$FIELD_SOURCE FROM RDB$RELATION_FIELDS R
WHERE R.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME )
and all the unused domains were gone afterwards.
But I don't guarantee for any side-effects.
Regards
Luic.-