Re: Redirecting query's output to a textfile?

From: Herb Blacker <herbblacker(at)isgenesis(dot)com>
To: Peter Peltonen <peter(dot)peltonen(at)fivetec(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Redirecting query's output to a textfile?
Date: 2002-02-15 19:18:51
Message-ID: 3C6D5F1B.4000702@isgenesis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If you use psql and your query is in a file, try this:

$psql <dbname>

<dbname># \o <filename> (puts the output of the next query in a file)

<dbname># \i <queryfile> (reads and executes the query from the file)

<dbname> \q (quit psql)

Peter Peltonen wrote:

> A basic question:
>
> How in PostgreSQL do I redirect the output of an SQL query to a textfile?
>
>

Hope this helps...
_________________________
Herb Blacker
Database Administrator
ReCare, Inc.
(512) 791-4340
herbblacker(at)isgenesis(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brian Hirt 2002-02-15 19:41:19 Re: Question: Who's Using Postgres
Previous Message Holger Marzen 2002-02-15 18:29:46 Re: Question: Who's Using Postgres