Author: Tomas Rutkauskas
Enumerating user tables in an InterBase database
Answer:
A list of user tables can be retrieved by querying system table rdb$relations.
The example below shows how to do this - it inserts the table names sorted
alphabetically into a ListBox (lbSourceTables).
1 begin2 ibcSourceList.SQL.Clear;
3 ibcSourceList.SQL.Add('select rdb$relation_name from rdb$relations');
4 ibcSourceList.SQL.Add('where rdb$system_flag = 0');
5 ibcSourceList.SQL.Add('order by rdb$relation_name');
6 ibcSourceList.Open;
7 whilenot ibcSourceList.Eof do8 begin9 lbSourceTables.Items.Add(ibcSourceList.Fields[0].AsString);
10 ibcSourceList.Next;
11 end;
12 ibcSourceList.Close;
13 end;