This is a discussion on convert text file to database within the pgsql Novice forums, part of the PostgreSQL category; --> Readers, I re-formatted an extract from my file of chess matches to: Event,Online Game,Site, http://www.flyordie.com,Date,yyyy/mm...l,1200,moves,1 . c4 e5...25. Qh7# ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Readers, I re-formatted an extract from my file of chess matches to: Event,Online Game,Site,http://www.flyordie.com,Date,yyyy/mm...l,1200,moves,1. c4 e5...25. Qh7# 1-0 Event,Online Game,Site,http://www.flyordie.com,Date,2008/01...l,1200,moves,1. d4 d5...33. Bf3 Rxe5 0-1 I tried to import the csv file using the command: chessmatches=# COPY chessgames FROM '/absolute/path/filename.csv'; ERROR: invalid input syntax for integer: "Event..." CONTEXT: COPY chessgames, line 1, column id: "Event,..." My first thoughts are that I need to create a first column entitle 'column id' but there is no reference to the requirement for this in the section of the manual COPY. SO what is required please? Thanks, -- Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-novice |
| ||||
| e-letter <inpost@gmail.com> writes: > I tried to import the csv file using the command: > chessmatches=# COPY chessgames FROM '/absolute/path/filename.csv'; > ERROR: invalid input syntax for integer: "Event..." Umm ... you didn't tell it the data is in CSV. I think you need at least the HEADER option too. See the COPY manual page: http://www.postgresql.org/docs/8.3/static/sql-copy.html regards, tom lane -- Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-novice |