Обсуждение: COPY to

Поиск
Список
Период
Сортировка

COPY to

От
Angshu Kar
Дата:
Hi Pgsql,

I want to copy the output of a SELECT query onto a text file. I'm trying to use the COPY command for that as :

COPY (SELECT .... ) to 'outfile'

But its throwing some error. Is it possible? Else, are there any means to do it?

Thanks,
AK

--
Ignore the impossible but honor it ...
The only enviable second position is success, since failure always comes first...

Re: COPY to

От
"A. Kretschmer"
Дата:
am  07.01.2006, um 14:13:28 -0600 mailte Angshu Kar folgendes:
> Hi Pgsql,
>
> I want to copy the output of a SELECT query onto a text file. I'm trying to
> use the COPY command for that as :
>
> COPY (SELECT .... ) to 'outfile'

Wrong.

\o output.txt
select ...
\o

And now you have the result in 'output.txt'.


HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

Re: COPY to

От
Angshu Kar
Дата:
Thanks Andreas. But how can I run this from the pgAdmin III Query tool in a WinXP m/c?


On 1/7/06, A. Kretschmer < andreas.kretschmer@schollglas.com> wrote:
am  07.01.2006, um 14:13:28 -0600 mailte Angshu Kar folgendes:
> Hi Pgsql,
>
> I want to copy the output of a SELECT query onto a text file. I'm trying to
> use the COPY command for that as :
>
> COPY (SELECT .... ) to 'outfile'

Wrong.

\o output.txt
select ...
\o

And now you have the result in 'output.txt'.


HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
===    Schollglas Unternehmensgruppe    ===

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster



--
Ignore the impossible but honor it ...
The only enviable second position is success, since failure always comes first...

Re: COPY to

От
Andreas Kretschmer
Дата:
Angshu Kar <angshu96@gmail.com> schrieb:

> Thanks Andreas. But how can I run this from the pgAdmin III Query tool in a
> WinXP m/c?

Sorry, i don't using pgAdmin nor windows...
I mean, use the CLI-Interface psql.

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

Re: COPY to

От
Angshu Kar
Дата:
Ok thanks Andreas

On 1/7/06, Andreas Kretschmer <akretschmer@spamfence.net> wrote:
Angshu Kar <angshu96@gmail.com> schrieb:

> Thanks Andreas. But how can I run this from the pgAdmin III Query tool in a
> WinXP m/c?

Sorry, i don't using pgAdmin nor windows...
I mean, use the CLI-Interface psql.

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend



--
Ignore the impossible but honor it ...
The only enviable second position is success, since failure always comes first...

Re: COPY to

От
Tino Wildenhain
Дата:
Angshu Kar schrieb:
> Thanks Andreas. But how can I run this from the pgAdmin III Query tool
> in a WinXP m/c?

You dont. There is the function for saving query data to file
already built in. Just press the button (documentation or tooltips
tell you) and select the format of your csv in the requester
that appears.

Re: COPY to

От
Angshu Kar
Дата:
Got it. Thanks a ton Tino...

On 1/8/06, Tino Wildenhain <tino@wildenhain.de> wrote:
Angshu Kar schrieb:
> Thanks Andreas. But how can I run this from the pgAdmin III Query tool
> in a WinXP m/c?

You dont. There is the function for saving query data to file
already built in. Just press the button (documentation or tooltips
tell you) and select the format of your csv in the requester
that appears.



--
Ignore the impossible but honor it ...
The only enviable second position is success, since failure always comes first...