Skip site navigation (1) Skip section navigation (2)

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:31:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin

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.



pgsql-admin by date

Next:From: DineshDate: 2007-12-20 01:44:10
Subject: including variables in copy command
Previous:From: DineshDate: 2007-12-20 01:28:21
Subject: including variables in COPY command

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group