including variables in COPY command

From: Dinesh <dbhandary(at)mongonet(dot)net>
To: pgsql-admin(at)postgresql(dot)org
Subject: including variables in COPY command
Date: 2007-12-20 01:28:21
Message-ID: 4769C535.2000603@mongonet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-admin by date

  From Date Subject
Next Message Dinesh 2007-12-20 01:31:04 including variables in copy command
Previous Message Phillip Smith 2007-12-19 23:42:32 Re: Dump database more than 1 flat file