Outputting select into file.

Поиск
Список
Период
Сортировка
От Lee Kindness
Тема Outputting select into file.
Дата
Msg-id 15392.46537.511719.871128@elsick.csl.co.uk
обсуждение исходный текст
Ответ на Outputting select into file.  (Troy.Campano@LibertyMutual.com)
Список pgsql-general
Troy.Campano@LibertyMutual.com writes:
 > I have postgres 7 running on RedHat Linux.
 > I was wondering if you knew of a way to run a select and output it to a
 > file.
 > SELECT * FROM TABLE >> test.out
 > So that test.out would have the results from that SQL Statement.

Either:

 SELECT * FROM table \g filename

to just output to the file 'filename', or:

 select * from lineshoot \g |cat >> /solsolute/path/filename

to append to the file. Both in psql, or:

 echo 'SELECT * FROM table' | psql database >> test.out

from your terminal.

Regards, Lee Kindness.

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Query hangs when getting too complex...
Следующее
От: "Greg Sabino Mullane"
Дата:
Сообщение: Re: Way to use count() and LIMIT?