Thread: Export query result to text file?

Export query result to text file?

From
"Patrick Hatcher"
Date:
Howdy,
I'm trying to use a query to export some data.  My file is created, but no
data is available.  If I run the query without exporting, it works fine.
Select * from table1 limit 100 \o /home/phatcher/test.txt;

must I always route the file first and then do my query?
Thanks

Patrick Hatcher
Macys.Com
Legacy Integration Developer
415-932-0610 office
HatcherPT - AIM




Re: Export query result to text file?

From
denis@coralindia.com
Date:
It works.... fine but creates a file "test.txt;" and not "test.txt"

If you do not give semicolon at the end, then it waits for it and if you
give it, it adds that in filename.

HTH

Denis



----- Original Message -----
From: "Patrick Hatcher" <PHatcher@macys.com>
To: <pgsql-novice@postgresql.org>
Sent: Thursday, March 28, 2002 4:10 AM
Subject: [NOVICE] Export query result to text file?


> Howdy,
> I'm trying to use a query to export some data.  My file is created, but no
> data is available.  If I run the query without exporting, it works fine.
> Select * from table1 limit 100 \o /home/phatcher/test.txt;
>
> must I always route the file first and then do my query?
> Thanks
>
> Patrick Hatcher
> Macys.Com
> Legacy Integration Developer
> 415-932-0610 office
> HatcherPT - AIM
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org


Re: Export query result to text file?

From
Ugly Hippo
Date:
Make it a two line query with the semi-colon on the
second line.

Troy


--- denis@coralindia.com wrote:
>
> It works.... fine but creates a file "test.txt;" and
> not "test.txt"
>
> If you do not give semicolon at the end, then it
> waits for it and if you
> give it, it adds that in filename.
>
> HTH
>
> Denis
>
>
>
> ----- Original Message -----
> From: "Patrick Hatcher" <PHatcher@macys.com>
> To: <pgsql-novice@postgresql.org>
> Sent: Thursday, March 28, 2002 4:10 AM
> Subject: [NOVICE] Export query result to text file?
>
>
> > Howdy,
> > I'm trying to use a query to export some data.  My
> file is created, but no
> > data is available.  If I run the query without
> exporting, it works fine.
> > Select * from table1 limit 100 \o
> /home/phatcher/test.txt;
> >
> > must I always route the file first and then do my
> query?
> > Thanks
> >
> > Patrick Hatcher
> > Macys.Com
> > Legacy Integration Developer
> > 415-932-0610 office
> > HatcherPT - AIM
> >
> >
> >
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the
> unregister command
>     (send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)


______________________________________________________________________
Music, Movies, Sports, Games! http://entertainment.yahoo.ca