Thread: Creating Textfiles out of tables

Creating Textfiles out of tables

From
Martin Möderndorfer
Date:
Hi,

i have some tables and want to extract results of a query on them into a
text-file. it should be possible to insert ":","{" between the different
tuples.

Any ideas

MArtin
mmoedern@linux.stuco.uni-klu.ac.at

Re: [GENERAL] Creating Textfiles out of tables

From
"jose' soares"
Date:

Martin Möderndorfer ha scritto:

> Hi,
>
> i have some tables and want to extract results of a query on them into a
> text-file. it should be possible to insert ":","{" between the different
> tuples.
>
> Any ideas
>
> MArtin
> mmoedern@linux.stuco.uni-klu.ac.at

psql joe

joe=> \t
turned off output headings and row count
joe=> \f :
field separator changed to ':'
joe=> select * from btmm;
a      : 13.2:FO
b      : 1.32:FO
c      :31.32:RO

if you type \o file_name
the result will be stored to a file named "file_name".

--
                               - Jose' -

And behold, I tell you these things that ye may learn wisdom; that ye may
learn that when ye are in the service of your fellow beings ye are only
in the service of your God.                - Mosiah 2:17 -



Re: [ADMIN] Creating Textfiles out of tables

From
Terry Mackintosh
Date:
Hi Martin

One why (there may be a better way), would be to do a 'select...into table
...from ....', now that you have the result set you want in a temp table,
use the copy command ( in psql do '\h copy' for help.)
Also, for select help do (in side psql) '\h select'.

Hope that helps
Terry

On Tue, 16 Feb 1999, Martin [iso-8859-1] M�derndorfer wrote:

> Hi,
>
> i have some tables and want to extract results of a query on them into a
> text-file. it should be possible to insert ":","{" between the different
> tuples.
>
> Any ideas
>
> MArtin
> mmoedern@linux.stuco.uni-klu.ac.at
>


Have a great day
Terry Mackintosh <terry@terrym.com>               http://www.terrym.com
sysadmin/owner                  I'm excited about life! How about YOU!?
Professional Web Hosting and site design to include programming
Proudly powered by R H Linux 4.2, Apache 1.3.x, PHP 3.x, PostgreSQL 6.x
-----------------------------------------------------------------------
Only if you know where you're going can you get there.