Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 19CC02E3033 for ; Wed, 19 Dec 2007 21:28:31 -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-02 for ; Wed, 19 Dec 2007 21:28:27 -0400 (AST) Received: from mongonet.net (mailgate.mongonet.net [64.157.94.58]) by postgresql.org (Postfix) with ESMTP id 131F82E2FF3 for ; Wed, 19 Dec 2007 21:28:26 -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 1235925 for pgsql-admin@postgresql.org; Wed, 19 Dec 2007 17:28:24 -0800 Message-ID: <4769C535.2000603@mongonet.net> Date: Wed, 19 Dec 2007 17:28:21 -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/194 X-Sequence-Number: 27711 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