Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9008F2E3F2F for ; Wed, 19 Dec 2007 21:31:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 31386-06-4 for ; Wed, 19 Dec 2007 21:31:12 -0400 (AST) Received: from mongonet.net (mailgate.mongonet.net [64.157.94.58]) by postgresql.org (Postfix) with ESMTP id 4B3402E3558 for ; Wed, 19 Dec 2007 21:31:09 -0400 (AST) Received: from [192.168.1.127] (account dbhandary [192.168.1.127] verified) by mongonet.net (CommuniGate Pro SMTP 5.1.12) with ESMTPSA id 1235951 for pgsql-admin@postgresql.org; Wed, 19 Dec 2007 17:31:07 -0800 Message-ID: <4769C5D8.5090307@mongonet.net> Date: Wed, 19 Dec 2007 17:31:04 -0800 From: Dinesh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: including variables in copy command Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/195 X-Sequence-Number: 27712 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