Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id B6E142E2F5B for ; Wed, 19 Dec 2007 21:44:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 70943-02 for ; Wed, 19 Dec 2007 21:44:05 -0400 (AST) Received: from mongonet.net (mailgate.mongonet.net [64.157.94.58]) by postgresql.org (Postfix) with ESMTP id 030E02E015D for ; Wed, 19 Dec 2007 21:44:15 -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 1236182 for pgsql-admin@postgresql.org; Wed, 19 Dec 2007 17:44:13 -0800 Message-ID: <4769C8EA.3000005@mongonet.net> Date: Wed, 19 Dec 2007 17:44:10 -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/188 X-Sequence-Number: 27705 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