| From: | ray <ray(at)aarden(dot)us> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | How to Create Table from CSV |
| Date: | 2011-03-06 18:43:22 |
| Message-ID: | b1361c5a-d8a5-4eb7-a284-20c5e52a0e26@j35g2000prb.googlegroups.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
I would like to create a table from a CSV file (the first line is
headers which I want to use as column names) saved from Excel. I have
a new database which I have been able to create tables from a
tutorial. But I haven’t been able to produce this new table. The
following are my attempts:
CREATE TABLE Equpment_List_Sheet2 FROM 'Equipment List, reference
r1_Sheet2.csv' WITH DELIMITER ',' NULL '' CSV HEADER;
ERROR: syntax error at or near "FROM"
LINE 1: CREATE TABLE Equpment_List_Sheet2 FROM 'Equipment List,
refe...
^
********** Error **********
ERROR: syntax error at or near "FROM"
SQL state: 42601
Character: 35
____________
copy TABLE Equpment_List_Sheet2 FROM 'Equipment List, reference
r1_Sheet2.csv' WITH DELIMITER ',' NULL '' CSV HEADER;
ERROR: syntax error at or near "TABLE"
LINE 1: copy TABLE Equpment_List_Sheet2 FROM 'Equipment List,
refere...
^
********** Error **********
ERROR: syntax error at or near "TABLE"
SQL state: 42601
Character: 6
______________
copy Equpment_List_Sheet2 FROM 'Equipment List, reference
r1_Sheet2.csv' WITH DELIMITER ',' NULL '' CSV HEADER;
ERROR: relation "equpment_list_sheet2" does not exist
********** Error **********
ERROR: relation "equpment_list_sheet2" does not exist
SQL state: 42P01
_______________
Thanks for any help,
ray
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vibhor Kumar | 2011-03-06 18:59:06 | Re: How to Create Table from CSV |
| Previous Message | Jon Nelson | 2011-03-06 17:32:27 | regarding ROW comparisons |