Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copying select result

Status
Not open for further replies.

kullimunni

Programmer
Jan 23, 2003
3
US
Hi,
I have installed postgreSQL on windows using cygwin. I am implementing the database for our accounting stuff. I found that I can copy table to a file using COPY command. I was wondering if there is any way by which I could copy the select results to a file. This will be of great use to me. Please hint me about this.

thanks
swetha
 
hello there,

I somewhat managed to find out a solution to my problem. Though its very crude...If the number of rows displayed by the select command is more than what the display window can handle, then it prompts for saving it in a file, since the display is large to accomadate on a single screen. But I guess there should be some command by which I can just store it to a file no matter what my screen size is... can anyone tell me what it is ?
Thanks
 
How about another workaround? Just create a view with your query, then run a COPY on the view.

Also, there are ways you can work from "outside" the psql client, piping a query to the client, and receiving the output to stdout or piping it to a text file. If these concepts are new to you, let me know, and I will provide some examples. -------------------------------------------

PHP/Perl/SQL/Javascript --
 
Ya I am very new to PostgreSQl... examples would be great for me. I will greatly appreciate your help thank u.

thanks again,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top