pg.ddx.io pgsql-admin@postgresql.org mailing list archivehelp / color / mirror / Atom feed
including variables in COPY command 4+ messages / 2 participants [nested] [flat]
* including variables in COPY command @ 2007-12-20 01:28 Dinesh <dbhandary@mongonet.net> 0 siblings, 0 replies; 4+ messages in thread From: Dinesh @ 2007-12-20 01:28 UTC (permalink / raw) To: pgsql-admin Hi ALL, I am trying to use Copy command to copy data from table to a flat file. Here is an example: copy ( select * from employee where hire_date between begin_date and end_date) to '/var/data/text.txt' delimiter ';'; But my problem is the query is not able to read variable begin_date and end_date. It works fine when I passed the real value. Has anyone used variable within a copy ? Please let me know. Thanks, Dinesh ^ permalink raw reply [nested|flat] 4+ messages in thread
* including variables in copy command @ 2007-12-20 01:31 Dinesh <dbhandary@mongonet.net> 0 siblings, 0 replies; 4+ messages in thread From: Dinesh @ 2007-12-20 01:31 UTC (permalink / raw) To: pgsql-admin Hi ALL, I am trying to use Copy command to copy data from table to a flat file. Here is an example: copy ( select * from employee where hire_date between begin_date and end_date) to '/var/data/text.txt' delimiter ';'; But my problem is the query is not able to read variable begin_date and end_date. It works fine when I passed the real value. Has anyone used variable within a copy ? Please let me know. Thanks, Dinesh ^ permalink raw reply [nested|flat] 4+ messages in thread
* including variables in copy command @ 2007-12-20 01:44 Dinesh <dbhandary@mongonet.net> 2007-12-20 02:04 ` Re: including variables in copy command Phillip Smith <phillip.smith@weatherbeeta.com.au> 0 siblings, 1 reply; 4+ messages in thread From: Dinesh @ 2007-12-20 01:44 UTC (permalink / raw) To: pgsql-admin Hi ALL, I am trying to use Copy command to copy data from table to a flat file. Here is an example: copy ( select * from employee where hire_date between begin_date and end_date) to '/var/data/text.txt' delimiter ';'; But my problem is the query is not able to read variable begin_date and end_date. It works fine when I passed the real value. Has anyone used variable within a copy ? Please let me know. Thanks, Dinesh ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: including variables in copy command 2007-12-20 01:44 including variables in copy command Dinesh <dbhandary@mongonet.net> @ 2007-12-20 02:04 ` Phillip Smith <phillip.smith@weatherbeeta.com.au> 0 siblings, 0 replies; 4+ messages in thread From: Phillip Smith @ 2007-12-20 02:04 UTC (permalink / raw) To: 'Dinesh' <dbhandary@mongonet.net>; pgsql-admin Could you wrap it in a transaction block? begin; select * into temp_table from employee where hire_date between begin_date and end_date; copy temp_table to '/var/data/text.txt' delimiter ';'; commit; THINK BEFORE YOU PRINT - Save paper if you don't really need to print this *******************Confidentiality and Privilege Notice******************* The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email. Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments e-mail. ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2007-12-20 02:04 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2007-12-20 01:28 including variables in COPY command Dinesh <dbhandary@mongonet.net> 2007-12-20 01:31 including variables in copy command Dinesh <dbhandary@mongonet.net> 2007-12-20 01:44 including variables in copy command Dinesh <dbhandary@mongonet.net> 2007-12-20 02:04 ` Re: including variables in copy command Phillip Smith <phillip.smith@weatherbeeta.com.au>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox