[Solved] Exporting a list of tables and fields
Posted: Mon Jun 24, 2024 10:25 am
I would like to export a list of all the tables and the field-names they contain, no data. Could be as .csv or .ods or else. Is this possible?
User community support forum for Apache OpenOffice, LibreOffice and all the OpenOffice.org derivatives
https://forum.openoffice.org/en/forum/
https://forum.openoffice.org/en/forum/viewtopic.php?t=111651
Code: Select all
Select
SYS_TABLES."TABLE_TYPE" as "TABLE or VIEW",
'"' || SYS_TABLES."TABLE_NAME" || '"' as "TABLE NAME",
SYS_COLUMNS."ORDINAL_POSITION" as "COLUMN POSITION",
'"' || SYS_COLUMNS."COLUMN_NAME" || '"' as "COLUMN NAME",
SYS_COLUMNS."TYPE_NAME" as "TYPE NAME",
SYS_COLUMNS."COLUMN_SIZE" as "COLUMN SIZE"
From "INFORMATION_SCHEMA"."SYSTEM_TABLES" as SYS_TABLES,
"INFORMATION_SCHEMA"."SYSTEM_COLUMNS" as SYS_COLUMNS
Where SYS_TABLES."TABLE_SCHEM" = 'PUBLIC'
and SYS_TABLES."TABLE_TYPE" IN ( 'TABLE', 'VIEW')
and SYS_TABLES."TABLE_NAME" = SYS_COLUMNS."TABLE_NAME"
Order By SYS_TABLES."TABLE_TYPE",
'"' || SYS_TABLES."TABLE_NAME" || '"',
SYS_COLUMNS."ORDINAL_POSITION"