community.borland.com

Article #25172: How to use the InterBase SYSTEM tables to select table name information.

Problem:
How to select metadata information manually from the InterBase
system tables.

Solution:
Examples: (tables only)

To extract non-system tables (and no views):
	SELECT RDB$RELATION_NAME
	FROM RDB$RELATIONS
	WHERE ((RDB$SYSTEM_FLAG = 0) OR 
	(RDB$SYSTEM_FLAG IS NULL)) AND 
	(RDB$VIEW_SOURCE IS NULL)
	ORDER BY RDB$RELATION_NAME

To extract system tables (no user defined tables): 
	SELECT RDB$RELATION_NAME
	FROM RDB$RELATIONS
	WHERE (RDB$SYSTEM_FLAG = 1) AND
	(RDB$VIEW_SOURCE IS NULL)
	ORDER BY RDB$RELATION_NAME

To extract all of the above information:
	SELECT RDB$RELATION_NAME
	FROM RDB$RELATIONS
	WHERE (RDB$VIEW_SOURCE IS NULL)
	ORDER BY RDB$RELATION_NAME

Last Modified: 29-SEP-00