On 01/17/2011 05:59 AM, Amar Dhole wrote:
I have table created as follows

CREATE TABLE D_2147483927_2147484848_TAB(

CP VARCHAR(256) ,

CPR VARCHAR(256) ,

CHOUSENO VARCHAR(256) ,

CSTREET VARCHAR(256) ,

CLOCALITY VARCHAR(256) ,

CCITY VARCHAR(256) ,

CPROVINCE VARCHAR(256) ,

CCOUNTRY VARCHAR(256) ,

CZIP VARCHAR(256) ,

CCO VARCHAR(256) )

I am using copy command to copy the content of file into the table.
(one.txt)

PR,PRO,HOUSENO,STREET,LOCALITY,CITY,PROVINCE,COUNTRY,ZIP,CON

,,A-24 Siddi vihar apt.,Near Krishna Chowk,New Sanghvi,Pune,MH,India,411027

In the above data, data for last column is missing.

Looks like two columns missing. I see 10 headers and 8 data values unless that is a cut and paste issue.


copy D_2147483927_2147484848_TAB from 'D:/work/one.txt' with delimiter
as ',' quote '"' csv HEADER ;

I get the following error as

ERROR: missing data for column "ccontains"

Where does ccontains from? I am not seeing it in the table or the text file.


CONTEXT: COPY d_2147483927_2147484848_tab, line 2: "q,q,A-24 Siddi vihar
apt.,

Near Krishna Chowk,New Sanghvi,Pune,MH,India,411027 "

Can any one please tell me how can I make copy command to ignore the
data missing column ? as the data in file is unknown so it column name
is which is missing is not known in advance.

You can specify a column list to COPY. See here:
http://www.postgresql.org/docs/9.0/interactive/sql-copy.html


Thanks

Amar



--
Adrian Klaver
adrian.kla...@gmail.com

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to