Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my code :
COPY donnees_essai_semences(num_rerf,id_essence,resultat_germination___,purete___,humidite___,graines_attaques___,test_tetrasodium___,test_fendage___,test_rayonx___,germination_parue,semence_parue,q_essainormalise_350p_,q_1haplantation,ue,note_essai,date_essai_recent)

FROM 'D:\bbc.csv' DELIMITER  ',' CSV HEADER;


but i have that prob whish says "invalid input syntax for type integer" , in fact my values re all integer
can u help guys , Thank u

What I have tried:

but i have that prob whish says "invalid input syntax for type integer" , in fact my values re all integer 
can u help guys , Thank u 

Posted
Updated 14-May-20 7:49am
Comments
phil.o 14-May-20 11:03am    
Without the input CSV file, there is not much we can say, apart from the fact that this input file does not match your COPY statement in some way.

1 solution

If your table has a SERIAL field it must not be included in the copy statement.
See examples here: Import CSV File Into PosgreSQL Table[^]
 
Share this answer
 
Comments
MOUAD MOUMENE 14-May-20 14:04pm    
i followed the same example but no result i still have the same error
MOUAD MOUMENE 14-May-20 14:07pm    
ERROR: invalid input syntax for type integer: "1;454;545;121;3213;32;12;223;1231;132;321;3123;321;52;05/08/2020"
CONTEXT: COPY donnees_essai_semences, line 2, column num_rerf: "1;454;545;121;3213;32;12;223;1231;132;321;3123;321;52;05/08/2020"
SQL state: 22P02
RickZeeland 14-May-20 14:11pm    
It looks like the problem is in the date "05/08/2020" that's not an integer!
So either leave it out or change your table so that it has a matching date field.
RickZeeland 14-May-20 14:12pm    
Also the delimiter should be ; instead of ,
MOUAD MOUMENE 14-May-20 14:37pm    
thanks bro that where the mistake was

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900