[Solved] Exporting a list of tables and fields

Getting your data onto paper - or the web - Discussing the reports features of Base
Post Reply
Yumi
Posts: 30
Joined: Fri Aug 29, 2008 3:54 am

[Solved] Exporting a list of tables and fields

Post by Yumi »

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?
Last edited by Yumi on Tue Jun 25, 2024 4:52 am, edited 1 time in total.
OOo 4.1.6 on Linux Mint 19.1 Tessa
User avatar
Sliderule
Volunteer
Posts: 1289
Joined: Thu Nov 29, 2007 9:46 am

Re: Exporting a list of tables and fields

Post by Sliderule »

You have not told us in this post, which database backend you are using . . . therefore . . . I will assume you are using HSQL.

You can create a Query as defined below . . . and . . . since you have a registered database ( I presume ), import it to Calc . . . and / or . . . save it as a CSV, or, ODS file.

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"
I hope this helps, please be sure to let me / us know.

Sliderule

Thanks to add [Solved] in your 1st post Subject (edit button top right) if this issue has been resolved.
Yumi
Posts: 30
Joined: Fri Aug 29, 2008 3:54 am

Re: Exporting a list of tables and fields

Post by Yumi »

It works without any modifications. Thanks for this advice and sorry to rely on your assumptions. It will help to bring different databases together and create a overview.
OOo 4.1.6 on Linux Mint 19.1 Tessa
Bidouille
Volunteer
Posts: 599
Joined: Mon Nov 19, 2007 10:58 am
Location: France

Re: Exporting a list of tables and fields

Post by Bidouille »

Sliderule wrote: Mon Jun 24, 2024 5:07 pmYou can create a Query as defined below . . . and . . . since you have a registered database ( I presume ), import it to Calc . . . and / or . . . save it as a CSV, or, ODS file.
With this OXT, the export in CSV made easy :)
User avatar
Sliderule
Volunteer
Posts: 1289
Joined: Thu Nov 29, 2007 9:46 am

Re: [Solved] Exporting a list of tables and fields

Post by Sliderule »

Bidouille:

Thanks for your suggestion of OXT extension.

I am sending you a PM ( Private Message ) .

Sliderule
Post Reply