Search Postgresql Archives

Re: How to Create Table from CSV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mar 7, 2011, at 12:13 AM, ray wrote:

> 
> 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



You can't create a table using CSV. However try following:
1. Create structure of table (Parse the column using some script or manually)
2. Import data using COPY Command.

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor.kumar@xxxxxxxxxxxxxxxx
Blog:http://vibhork.blogspot.com


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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux